Rather than using the ‘pip’ installable mod_wsgi, you might want to try older
way of building it from source code.
Grab down latest source tar ball from:
https://github.com/GrahamDumpleton/mod_wsgi/releases
<https://github.com/GrahamDumpleton/mod_wsgi/releases>
When unpacked, build it using:
./configure —with-python=/some/path/to/canopy/bin/python
make
Before trying to install it, run:
otool -L src/server/.libs/mod_wsgi.so
If that doesn’t show the Python library resolving, try instead:
make distclean
./configure —with-python=/some/path/to/canopy/bin/python --enable-framework
make
Run otool again. Does that then show it as resolving?
Graham
> On 14 Apr 2016, at 10:13 PM, SGaffney <[email protected]> wrote:
>
> Thank you for the very fast response—excuse my slowness, caused by not
> setting up email alerts properly.
>
> Starting with last question first, the Python library/executable files:
>
> 1. Python / 'libpython2.7.so'
> ======================
>
> $ find /Applications/Canopy.app -name Python -print
> /Applications/Canopy.app/Contents/Python
> /Applications/Canopy.app/Contents/Resources/Python.app/Contents/MacOS/Python
> /Applications/Canopy.app/Contents/Resources/PythonNoDock.app/Contents/MacOS/Python
> /Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/Python
> /Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/Resources/Python.app/Contents/MacOS/Python
> /Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/Resources/PythonNoDock.app/Contents/MacOS/Python
> *items 1,4: Mach-O 64-bit dynamically linked shared library x86_64
> *items 2,3,5,6: Mach-O 64-bit executable x86_64
>
> Item 1 is the source file for the following symlinks:
> ~/Library/Enthought//Canopy_64bit/User/Python
> ~/Library/Enthought//Canopy_64bit/System/Python
> ~/Library/Enthought//Canopy_64bit/User/lib/libpython2.7.dylib
> ~/Library/Enthought//Canopy_64bit/System/lib/libpython2.7.dylib
>
> Item 1 otool output:
> Mach header
> magic cputype cpusubtype caps filetype ncmds sizeofcmds
> flags
> MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 12 1656
> NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS
>
> 4 additional 'Python' executables in ~
> --------------------------------------------------
> ~/Library/Enthought//Canopy_64bit/User/Resources/Python.app/Contents/MacOS/Python
> ~/Library/Enthought//Canopy_64bit/System/Resources/Python.app/Contents/MacOS/Python
> ~/Library/Enthought//Canopy_64bit/User/Resources/PythonNoDock.app/Contents/MacOS/Python
> ~/Library/Enthought//Canopy_64bit/System/Resources/PythonNoDock.app/Contents/MacOS/Python
> * all Mach-O 64-bit executable x86_64
>
>
> 2. SDKs
> =======
>
> My mac (OSX 10.11) has 3 SDKs installed after multiple OS X and XCode updates:
> /Developer/SDKs/MacOSX10.5.sdk/
> /Developer/SDKs/MacOSX10.6.sdk.hide/
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/bin/apr-1-config
> Note the '.hide' appended to the 10.6 SDK. Compilation of mod_wsgi-express
> didn't work until I did that. 10.6 is only there in response to an earlier
> Canopy issue. I installed it in Mavericks after seeing this Canopy support
> post
> <https://support.enthought.com/hc/en-us/articles/204469410-OS-X-GCC-Clang-and-Cython-in-10-9-Mavericks>.
>
>
> 3. Canopy lib folders
> ================
>
> $ tree /Applications/Canopy.app/Contents/lib/
> /Applications/Canopy.app/Contents/lib/
> └── python2.7
> ├── config
> │ ├── Makefile
> │ ├── Setup
> │ ├── Setup.config
> │ ├── Setup.local
> │ ├── config.c
> │ ├── config.c.in
> │ ├── enthought.dat
> │ ├── install-sh
> │ ├── libpython2.7.a
> │ ├── libpython2.7.dylib
> │ ├── makesetup
> │ └── python.o
> ├── lib-dynload
> │ └── fcntl.so
> ├── os.py
> └── site.py
>
>
> Other lib directories in Canopy default virtual environments.
> ~/Library/Enthought/Canopy_64bit//System/lib
> ~/Library/Enthought/Canopy_64bit//User/lib
>
> 4. httpd
> ======
>
> $ file /usr/sbin/httpd
> /usr/sbin/httpd: Mach-O 64-bit executable x86_64
>
>
> 5. mod-wsgi-py27.so
> =================
> path:
> ~/Library/Enthought/Canopy_64bit/User//lib/python2.7/site-packages/mod_wsgi-4.5.1-py2.7-macosx-10.6-x86_64.egg/mod_wsgi/server/mod_wsgi-py27.so
> size: 241Kb
> file: Mach-O 64-bit bundle x86_64
> otool:
> magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
> MH_MAGIC_64 X86_64 ALL 0x00 BUNDLE 13 1672 NOUNDEFS
> DYLDLINK TWOLEVEL
>
>
> 6. *-config files
> ===========
>
> python2.7-config
> ----------------------
> /usr/bin/python2.7-config
> /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
> /Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/bin/python2.7-config
> ~/Library/Enthought/Canopy_64bit/System/bin/python2.7-config
> ~/Library/Enthought/Canopy_64bit/User/bin/python2.7-config
>
> apr-1-config
> ----------------
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/bin/apr-1-config
> /Developer/SDKs/MacOSX10.5.sdk/usr/bin/apr-1-config
> /Developer/SDKs/MacOSX10.6.sdk.hide/usr/bin/apr-1-config
> /usr/bin/apr-1-config
> /usr/local/Library/ENV/4.3/apr-1-config
>
> Thanks for your time and for any further pointers,
>
> Stephen
>
>
>
> On Wednesday, April 13, 2016 at 11:43:32 AM UTC+1, Graham Dumpleton wrote:
> Actually this could just be it not even finding the Python framework. On
> older MacOS X versions it wasn’t uncommon for third party Python
> installations to screw things up so that it wasn’t actually possible to link
> to their framework from a separate application.
>
> All the LD_RUN_PATH is not used on MacOS X. That is Linux or Solaris.
>
> I can’t remember how to you fix up the framework reference in mod_wsgi.so if
> it is broken.
>
> I don’t think you can simply set the environment variable:
>
>
> DYLD_LIBRARY_PATH=/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib
>
> when running mod_wsgi-express.
>
> That doesn’t seem to be the correct directory for where the framework library
> might be installed anyway.
>
> What do you get for:
>
> find /Applications/Canopy.app -name Python -print
>
> Graham
>
>> On 13 Apr 2016, at 8:34 PM, Graham Dumpleton <graham.d...@ <>gmail.com
>> <http://gmail.com/>> wrote:
>>
>> Are you really running MacOS X 10.6?
>>
>> This issue used to come up in old MacOS X versions.
>>
>> The problem is that one of Apache, mod_wsgi or the Python library doesn’t
>> have a binary image in it for the required architecture. That is, 32 bit or
>> 64 bit.
>>
>> What do you get when you run:
>>
>> file mod_wsgi-py27.so
>>
>> file /usr/sbin/httpd
>>
>> file
>> /Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/libpython2.7.so
>> <http://libpython2.7.so/>
>>
>> You may have to work out the correct path for each of these.
>>
>> There was some notes about related issue in really old documentation on old
>> Google Code site about things like this.
>>
>>
>> https://code.google.com/archive/p/modwsgi/wikis/InstallationOnMacOSX.wiki
>> <https://code.google.com/archive/p/modwsgi/wikis/InstallationOnMacOSX.wiki>
>>
>> Graham
>>
>>> On 13 Apr 2016, at 8:25 PM, SGaffney <sgga...@ <>gmail.com
>>> <http://gmail.com/>> wrote:
>>>
>>> Hello,
>>>
>>> I'm struggling with installation of mod_wsgi-express in my Canopy
>>> distribution. Compilation works fine (output from python setup.py install
>>> is attached), but when I run `mod_wsgi-express start-server`, I get the
>>> error "Library not loaded: @rpath/Python" (follows email).
>>>
>>> From related support posts, I see that setting the LD_RUN_PATH at
>>> compilation is crucial, but the setup.py file seems to get mine right:
>>> [from debugger inspection in setup.py before "# Now finally run distutils."]
>>> >> LD_RUN_PATH
>>> '/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib:/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/config'
>>> >> PYTHON_LDFLAGS
>>> ['-L/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib',
>>>
>>> '-L/Applications/Canopy.app/appdata/canopy-1.6.2.3262.macosx-x86_64/Canopy.app/Contents/lib/python2.7/config']
>>> >> PYTHON_LDLIBS
>>> ['-lpython2.7']
>>>
>>> And here's the output of ldd on the .so file:
>>> > ldd mod_wsgi-py27.so
>>> @rpath/Python (compatibility version 2.7.0, current version 2.7.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
>>> version 1226.10.1)
>>>
>>> I'd be very grateful for any suggestions.
>>>
>>> Thank you,
>>>
>>> Stephen
>>>
>>> -------
>>>
>>> $ mod_wsgi-express start-server
>>> Server URL : http://localhost:8000/ <http://localhost:8000/>
>>> Server Root : /tmp/mod_wsgi-localhost:8000:502
>>> Server Conf : /tmp/mod_wsgi-localhost:8000:502/httpd.conf
>>> Error Log File : /tmp/mod_wsgi-localhost:8000:502/error_log (warn)
>>> Request Capacity : 5 (1 process * 5 threads)
>>> Request Timeout : 60 (seconds)
>>> Queue Backlog : 100 (connections)
>>> Queue Timeout : 45 (seconds)
>>> Server Capacity : 20 (event/worker), 20 (prefork)
>>> Server Backlog : 500 (connections)
>>> Locale Setting : en_GB.UTF-8
>>> httpd (mod_wsgi-express) : Syntax error on line 151 of
>>> /tmp/mod_wsgi-localhost:8000:502/httpd.conf: Cannot load
>>> /Users/sgg/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mod_wsgi-4.5.1-py2.7-macosx-10.6-x86_64.egg/mod_wsgi/server/mod_wsgi-py27.so
>>> into server:
>>> dlopen(/Users/sgg/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mod_wsgi-4.5.1-py2.7-macosx-10.6-x86_64.egg/mod_wsgi/server/mod_wsgi-py27.so,
>>> 10): Library not loaded: @rpath/Python\n Referenced from:
>>> /Users/sgg/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mod_wsgi-4.5.1-py2.7-macosx-10.6-x86_64.egg/mod_wsgi/server/mod_wsgi-py27.so\n
>>> Reason: image not found
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "modwsgi" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>> To post to this group, send email to mod...@ <>googlegroups.com
>>> <http://googlegroups.com/>.
>>> Visit this group at https://groups.google.com/group/modwsgi
>>> <https://groups.google.com/group/modwsgi>.
>>> For more options, visit https://groups.google.com/d/optout
>>> <https://groups.google.com/d/optout>.
>>> <setup.py_install_output.txt>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.