Repository navigation
Libraries missing after setup.py install on OSX #392
Copy link
Copy link
Closed
Labels
Description
Environment
- Pythonnet version: v2.2.0-dev1-26-gb1cd3d1 (
git describe --tags), branchmac-osx - Python version: Python 3.5.2 :: Anaconda 4.3.0 (x86_64)
- Operating System: OSX El Capitan 10.11.6
Details
-
Checked out the branch, and run
python setup.py install. This worked, after setting
'PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/4.6.2/lib/pkgconfig`
(see dump below) -
Import fails
(py35) vasilios@exumas:~/Temp/pythonnet [mac-osx | ✚1 …2]
└─ $ python -c "import clr"
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/usr/local/anaconda/envs/py35/lib/mono/4.5/mscorlib.dll' directory.- Manually added a symbolic link to the respective mono folder, and trying import again
vasilios@exumas: /usr/local/anaconda/envs/py35/lib
└─ $ ln -s /Library/Frameworks/Mono.framework/Versions/Current/lib/mono(py35) vasilios@exumas:~/Temp/pythonnet [mac-osx | ✚1 …2]
└─ $ python -c "import clr"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: System.TypeInitializationException: The type initializer for 'Mono.Unix.Native.Stdlib' threw an exception. ---> System.DllNotFoundException: MonoPosixHelper
at (wrapper managed-to-native) Mono.Unix.Native.Stdlib:GetDefaultSignal ()
at Mono.Unix.Native.Stdlib..cctor () [0x00006] in <ebe430c916fe49219627b20fd4c89313>:0
--- End of inner exception stack trace ---
at Mono.Unix.UnixMarshal.AllocHeap (System.Int64 size) [0x00018] in <ebe430c916fe49219627b20fd4c89313>:0
at Mono.Unix.UnixMarshal.StringToHeap (System.String s, System.Int32 index, System.Int32 count, System.Text.Encoding encoding) [0x00061] in <ebe430c916fe49219627b20fd4c89313>:0
at Mono.Unix.UnixMarshal.StringToHeap (System.String s, System.Text.Encoding encoding) [0x00008] in <ebe430c916fe49219627b20fd4c89313>:0
at Python.Runtime.Utf32Marshaler.MarshalManagedToNative (System.Object obj) [0x00019] in <e8f6e1fa95374383b3f862986f3e768c>:0
at (wrapper managed-to-native) Python.Runtime.Runtime:PyUnicode_FromKindAndString (int,string,int)
at Python.Runtime.Runtime.PyUnicode_FromUnicode (System.String s, System.Int32 size) [0x00000] in <e8f6e1fa95374383b3f862986f3e768c>:0
at Python.Runtime.Runtime.PyUnicode_FromString (System.String s) [0x00007] in <e8f6e1fa95374383b3f862986f3e768c>:0
at Python.Runtime.Runtime.Initialize () [0x0010f] in <e8f6e1fa95374383b3f862986f3e768c>:0
at Python.Runtime.PythonEngine.Initialize () [0x00014] in <e8f6e1fa95374383b3f862986f3e768c>:0
at Python.Runtime.PythonEngine.InitExt () [0x00000] in <e8f6e1fa95374383b3f862986f3e768c>:0 Still looking at this issue, just though this may take you a step further. Any help would appreciated.
Output of Step 1
(py35) vasilios@exumas:~/Temp/pythonnet [mac-osx | ✔]
└─ $ set | grep PKG
PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/4.6.2/lib/pkgconfig
(py35) vasilios@exumas:~/Temp/pythonnet [mac-osx | ✔]
└─ $ python setup.py install
/usr/local/anaconda/envs/py35/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/setuptools/dist.py:331: UserWarning: Normalizing '2.2.0-dev1' to '2.2.0.dev1'
running install
running bdist_egg
running egg_info
writing pythonnet.egg-info/PKG-INFO
writing top-level names to pythonnet.egg-info/top_level.txt
writing dependency_links to pythonnet.egg-info/dependency_links.txt
reading manifest file 'pythonnet.egg-info/SOURCES.txt'
writing manifest file 'pythonnet.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 3.5.0.
NuGet.exe is up to date.
MSBuild auto-detection: using msbuild version '14.1' from '/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/14.1/bin/'.
All packages listed in packages.config are already installed.
XBuild Engine Version 14.0
Mono, Version 4.6.2.0
Copyright (C) 2005-2013 Various Mono authors
/Users/vasilios/Temp/pythonnet/pythonnet.sln: warning : The project configuration for project 'clrmodule' corresponding to the solution configuration 'ReleaseMono|x64' was not found.
XBuild Engine Version 14.0
Mono, Version 4.6.2.0
Copyright (C) 2005-2013 Various Mono authors
Configuration: ReleaseMono Platform: x64
assemblymanager.cs(206,37): warning CS0168: The variable `e' is declared but never used
classderived.cs(143,26): warning CS0219: The variable `fb' is assigned but its value is never used
classderived.cs(832,17): warning CS0219: The variable `t' is assigned but its value is never used
methodbinder.cs(145,36): warning CS0219: The variable `typeArgs' is assigned but its value is never used
methodbinding.cs(114,25): warning CS0219: The variable `len' is assigned but its value is never used
methodbinding.cs(153,24): warning CS0219: The variable `superType' is assigned but its value is never used
runtime.cs(2063,16): warning CS0472: The result of comparing value type `System.IntPtr' with null is always `true'
converter.cs(26,21): warning CS0414: The private field `Python.Runtime.Converter.decimalType' is assigned but its value is never used
/Users/vasilios/Temp/pythonnet/pythonnet.sln: warning : The project configuration for project 'clrmodule' corresponding to the solution configuration 'ReleaseMono|x64' was not found.
Configuration: ReleaseMono Platform: x64
fieldtest.cs(21,17): warning CS0219: The variable `i' is assigned but its value is never used
fieldtest.cs(22,17): warning CS0219: The variable `j' is assigned but its value is never used
arraytest.cs(45,23): warning CS0414: The private field `Python.Test.PrivateArrayTest.items' is assigned but its value is never used
Configuration: ReleaseMono Platform: x64
pyimport.cs(47,17): warning CS0219: The variable `r' is assigned but its value is never used
Configuration: Release Platform: x64
assemblyinfo.cs(13,50): warning CS0618: `System.Security.Permissions.SecurityAction.RequestMinimum' is obsolete: `This requests should not be used'
pythonconsole.cs(18,28): warning CS0219: The variable `a' is assigned but its value is never used
creating build/bdist.macosx-10.6-x86_64
creating build/bdist.macosx-10.6-x86_64/egg
copying build/lib.macosx-10.6-x86_64-3.5/clr.cpython-35m-darwin.so -> build/bdist.macosx-10.6-x86_64/egg
creating stub loader for clr.cpython-35m-darwin.so
byte-compiling build/bdist.macosx-10.6-x86_64/egg/clr.py to clr.cpython-35.pyc
installing package data to build/bdist.macosx-10.6-x86_64/egg
running install_data
copying /Users/vasilios/Temp/pythonnet/build/lib.macosx-10.6-x86_64-3.5/Python.Runtime.dll -> build/bdist.macosx-10.6-x86_64/egg/../../../../../../../usr/local/anaconda/envs/py35/lib/python3.5/site-packages
creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying pythonnet.egg-info/PKG-INFO -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying pythonnet.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying pythonnet.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying pythonnet.egg-info/not-zip-safe -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying pythonnet.egg-info/top_level.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
writing build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/native_libs.txt
creating 'dist/pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg' and adding 'build/bdist.macosx-10.6-x86_64/egg' to it
removing 'build/bdist.macosx-10.6-x86_64/egg' (and everything under it)
Processing pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg
removing '/usr/local/anaconda/envs/py35/lib/python3.5/site-packages/pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg' (and everything under it)
creating /usr/local/anaconda/envs/py35/lib/python3.5/site-packages/pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg
Extracting pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg to /usr/local/anaconda/envs/py35/lib/python3.5/site-packages
pythonnet 2.2.0.dev1 is already the active version in easy-install.pth
Installed /usr/local/anaconda/envs/py35/lib/python3.5/site-packages/pythonnet-2.2.0.dev1-py3.5-macosx-10.6-x86_64.egg
Processing dependencies for pythonnet==2.2.0.dev1
Finished processing dependencies for pythonnet==2.2.0.dev1Reactions are currently unavailable
Activity
den-run-ai commentedon Feb 18, 2017
@fractus don't use mac osx branch, it is not finished. Also report your mono installation steps.
follow this issue on osx:
#120
fractus commentedon Feb 18, 2017
Thanks -- I'll wait until it's merged.
http://www.mono-project.com/download/.
conda create -n py35 python=3.5 anacondapkg-configis build from sources.den-run-ai commentedon Feb 19, 2017
@fractus the issue "System.DllNotFoundException: MonoPosixHelper" is quite known on Windows and OSX with Mono, just google it.
Also you may have more tested mono installation with
brew install mono.vmuriart commentedon Feb 24, 2017
@fractus have you tried building or using the current
masterbranch? We removed references to mono libraries in b4710fc and 359e541.fractus commentedon Feb 24, 2017
@vmuriart
Thanks, it is working now, with a minor change in setup.py to use
otoolrather thanldd. You may want to incorporate this for OSX builds.vmuriart commentedon Feb 24, 2017
The osx branch you originally used was mostly trying to setup Travis to test on OSX. @denfromufa we should probably delete the branch to avoid confusion in the future.
@fractus interested in submitting a
PRfor this? You can piggy-back on the platform check to determine which command should be called.vmuriart commentedon Mar 1, 2017
@fractus which part of the issue still remains unsolved? is it just
PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/4.6.2/lib/pkgconfignow?fractus commentedon Mar 1, 2017
@vmuriart
Yes, for building and installing the package (for 2.7, 3.5 and 3.6).
In addition, though:
NOTE: The above were run in conda environments created as described above.
vmuriart commentedon Mar 1, 2017
The
dllnotfoundexceptionis due to thedll.configbeing written for Linux. Thats what #120 was trying to solve. I just removed the dependency ondll.configa couple hours ago on 9650e8b. Try building that one and you shouldnt have thedllnotfoundexceptionanymore.irt to having to link the library and define
pkg_config_path, can you check what value of rtdir is with and without the symbolic link.I think you have multiple
monoinstalled on your system and it may be using the wrong one to build and perform everything else.vmuriart commentedon Mar 1, 2017
what was the output of
step 1without settingPKG_CONFIG_PATH? Above only included the output after it succeeded.fractus commentedon Mar 1, 2017
@vmuriart
Sorry, my bad for the dll error -- it works after updating master.
I have recently updated to 4.6.2, and removed the previous version; is there a chance something is not done properly? I'll try with the latest mono version (4.8).
rtdir:PKG_CONFIG_PATH:NOTE: All in new temp conda environments and new clone of this project. This is a log of all commands, if it provides any further clues, log35.txt
fractus commentedon Mar 1, 2017
@vmuriart
You can avoid setting the
PKG_EXPORT_PATHif you use thepkg-configthat is part of the mono installation;Just need a symbolic link to
/usr/local/bin, since mono doesn't put it in path.Same issue with 4.8.0. I also explicitly updated the dyld cache using
update_dyld_shared_cache. I'll see if there's any "dangling" refs to some older installation.Note that installing a new version using the pkg from http://www.mono-project.com/download/ removes the previous one....
fractus commentedon Mar 1, 2017
The .so file seems to points to the correct path:
vmuriart commentedon Mar 1, 2017
Thanks for testing this for us! I had a strong inkling the change fixed it, but wasn't 100% sure.
From the logs, its finding the right
monoduring setup and even seems to have the rightrtdir. I'm a bit stumped on this one at the moment.fractus commentedon Mar 1, 2017
A step further (no manual symbolic links; moved to 4.8.0):
libJPEG.dylibin System and mono are different:I feel I'm deviating on a tangent here, so I'll just stop at this point, because with the symbolic link all works fine.
vmuriart commentedon Mar 2, 2017
yea. I'll leave the issue open for now in case someone else has a similar issue. I'm not sure if its an issue isolated to the setup you are using, or something else altogether.
Glad to hear all else works fine though after the symlink. And thanks for the detailed troubleshooting and information
den-run-ai commentedon Aug 10, 2017
@vmuriart @fractus I'm closing this issue, let's keep open this issue below for all Mac OSX settings and gotchas until the CI support is merged:
#465