Unable to load mod_wsgi: Symbol not found: __Py_FalseStruct - python

I'm trying to install mod_wsgi (3.4) on my mac (mountain lion), I followed all the instructions here: http://code.google.com/p/modwsgi/wiki/InstallationInstructions but I'm unable to load that module due to the following error:
httpd: Syntax error on line 119 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_wsgi.so into server: dlopen(/usr/libexec/apache2/mod_wsgi.so, 10): Symbol not found: __Py_FalseStruct\n Referenced from: /usr/libexec/apache2/mod_wsgi.so\n Expected in: flat namespace\n in /usr/libexec/apache2/mod_wsgi.so
the message above is displayed by testing apache modules with:
apachectl -M
I have the default python mac install (2.7) plus the latest 3.3 manually installed using the dedicated dmg, when I ran ./configure I tried by specifying both versions and adding the flag --disable-framework (which honestly I don't know what it does, but I found it mentioned in other discussions).
I'm stuck... what should I do?
UPDATE:
I configured mod_wsgi (with default python 2.7) by running:
make distclean
./configure
make
sudo make install
anyway I would like to use python 3.3, and fix the error I reported above

mod_wsgi is a pain to install if you don't really know the bits and pieces that go along with it. At a guess, I'd say it has something to do with shared python libraries .Can I recommend using the homebrew package manager instead?
It's fairly straight forward installing brew, but installing mod_wsgi isn't anymore.
brew tap homebrew/apache
brew install mod_wsgi
Then follow the instructions after it completes. You'll have to change the directory where mod_wsgi is installed to.
A warning about homebrew though, you need to make sure you've got the latest version of XCode installed, or at least the xcode command line tools. Homebrew is great though.

Related

Error installing Python 2 via Homebrew on MacOS Mojave

I'm having a lot of trouble with installing Python 2.7 on the MacOS 10.14 Mojave Beta.
Yes, I know that Python 2 comes pre-installed on the Mac, but I need a framework build of Python for my task.
I've tried re-installing the command line tools and then installing Python 2.7 as suggested here and here, but am still having issues - below is my output:
NickLaptop:~ nicholasarner$ brew reinstall python#2
==> Reinstalling python#2
==> Downloading https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2-2.7.15.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python#2/2.7.15_1 --enable-ipv6 --datarootdir=/usr/l
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python#2/2.7.15_1
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python#2/2.7.15_1/share/python#
==> Downloading https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--setuptools-39.2.0.zip
==> Downloading https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--pip-10.0.1.tar.gz
==> Downloading https://files.pythonhosted.org/packages/2a/fb/aefe5d5dbc3f4fe1e815bcdb05cbaab19
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--wheel-0.31.1.tar.gz
==> make html
Last 15 lines from /Users/nicholasarner/Library/Logs/Homebrew/python#2/05.make:
return build_main(argv)
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/cmd/build.py", line 22, in build_main
from sphinx import cmdline
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/cmdline.py", line 23, in <module>
from sphinx.application import Sphinx
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/application.py", line 29, in <module>
from sphinx.config import Config
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/config.py", line 21, in <module>
from sphinx.util import logging
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/__init__.py", line 33, in <module>
from sphinx.util import logging
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/logging.py", line 106, in <module>
class SphinxLoggerAdapter(logging.LoggerAdapter):
AttributeError: 'module' object has no attribute 'LoggerAdapter'
make: *** [build] Error 1
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
python 3.7.0 https://github.com/Homebrew/homebrew-core/pull/29490
python upgrade failing https://github.com/Homebrew/homebrew-core/issues/29214
app-engine-python 1.9.70 https://github.com/Homebrew/homebrew-core/pull/28858
molecule: Use correct `docker` python package dependency https://github.com/Homebrew/homebrew-core/pull/28635
[root] formula does not link against python#2 correctly. https://github.com/Homebrew/homebrew-core/issues/29377
clingo add support for lua, use python 3 https://github.com/Homebrew/homebrew-core/pull/28057
OSError: [Errno 1] Operation not permitted for python#2 –with-tcl-tk https://github.com/Homebrew/homebrew-core/issues/28168
Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues
Any help is appreciated!
EDIT Please don't suggest Anaconda! For what I'm working on, I specifically need a framework built version of Python via Brew.
EDIT 2 - I tried reinstalling Sphinx, which happened with no problems. Upon doing that, I tried running install python#2 again, but had the same issue as before.
Below is the output of running brew doctor
NickLaptop:~ nicholasarner$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/usr/local/CrossPack-AVR/bin/libusb-config
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libFLAC.8.2.0.dylib
/usr/local/lib/libcdt.5.dylib
/usr/local/lib/libcgraph.6.dylib
/usr/local/lib/libcsnd6.6.0.dylib
/usr/local/lib/libfltk.1.1.dylib
/usr/local/lib/libfltk.1.3.dylib
/usr/local/lib/libfltk_forms.1.3.dylib
/usr/local/lib/libfltk_images.1.1.dylib
/usr/local/lib/libfltk_images.1.3.dylib
/usr/local/lib/libfluidsynth.1.dylib
/usr/local/lib/libgraph.5.dylib
/usr/local/lib/libgvc.6.dylib
/usr/local/lib/libgvpr.2.dylib
/usr/local/lib/liblo.0.dylib
/usr/local/lib/libluajit-5.1.2.0.2.dylib
/usr/local/lib/libmpadec.dylib
/usr/local/lib/libpathplan.4.dylib
/usr/local/lib/libpng12.0.dylib
/usr/local/lib/librealsense.1.12.1.dylib
/usr/local/lib/libsfml-audio.2.0.dylib
/usr/local/lib/libsfml-graphics.2.0.dylib
/usr/local/lib/libsfml-network.2.0.dylib
/usr/local/lib/libsfml-system.2.0.dylib
/usr/local/lib/libsfml-window.2.0.dylib
/usr/local/lib/libsndfile.1.dylib
/usr/local/lib/libwiiuse.dylib
/usr/local/lib/libxdot.4.dylib
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/graphviz/arith.h
/usr/local/include/graphviz/cdt.h
/usr/local/include/graphviz/cgraph.h
/usr/local/include/graphviz/color.h
/usr/local/include/graphviz/geom.h
/usr/local/include/graphviz/graph.h
/usr/local/include/graphviz/graphviz_version.h
/usr/local/include/graphviz/gvc.h
/usr/local/include/graphviz/gvcext.h
/usr/local/include/graphviz/gvcjob.h
/usr/local/include/graphviz/gvcommon.h
/usr/local/include/graphviz/gvconfig.h
/usr/local/include/graphviz/gvplugin.h
/usr/local/include/graphviz/gvplugin_device.h
/usr/local/include/graphviz/gvplugin_layout.h
/usr/local/include/graphviz/gvplugin_loadimage.h
/usr/local/include/graphviz/gvplugin_render.h
/usr/local/include/graphviz/gvplugin_textlayout.h
/usr/local/include/graphviz/gvpr.h
/usr/local/include/graphviz/pack.h
/usr/local/include/graphviz/pathgeom.h
/usr/local/include/graphviz/pathplan.h
/usr/local/include/graphviz/textpara.h
/usr/local/include/graphviz/types.h
/usr/local/include/graphviz/usershape.h
/usr/local/include/graphviz/xdot.h
/usr/local/include/jack/control.h
/usr/local/include/jack/intclient.h
/usr/local/include/jack/jack.h
/usr/local/include/jack/jslist.h
/usr/local/include/jack/metadata.h
/usr/local/include/jack/midiport.h
/usr/local/include/jack/net.h
/usr/local/include/jack/ringbuffer.h
/usr/local/include/jack/session.h
/usr/local/include/jack/statistics.h
/usr/local/include/jack/systemdeps.h
/usr/local/include/jack/thread.h
/usr/local/include/jack/transport.h
/usr/local/include/jack/types.h
/usr/local/include/jack/uuid.h
/usr/local/include/jack/weakjack.h
/usr/local/include/jack/weakmacros.h
/usr/local/include/librealsense/rs.h
/usr/local/include/librealsense/rsutil.h
/usr/local/include/runt.h
/usr/local/include/sndfile.h
/usr/local/include/soundpipe.h
/usr/local/include/sporth.h
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/liblo.la
/usr/local/lib/libsndfile.la
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/jack.pc
/usr/local/lib/pkgconfig/libcdt.pc
/usr/local/lib/pkgconfig/libcgraph.pc
/usr/local/lib/pkgconfig/libgraph.pc
/usr/local/lib/pkgconfig/libgvc.pc
/usr/local/lib/pkgconfig/libgvpr.pc
/usr/local/lib/pkgconfig/libpathplan.pc
/usr/local/lib/pkgconfig/libxdot.pc
/usr/local/lib/pkgconfig/sndfile.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/liblua.a
/usr/local/lib/librunt.a
/usr/local/lib/libsndfile.a
/usr/local/lib/libsoundpipe.a
/usr/local/lib/libsporth.a
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
lua
libsndfile
ruby
Warning: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/bin/git-remote-keybase
/usr/local/bin/keybase
/usr/local/bin/lua
/usr/local/bin/lua-5.2
/usr/local/bin/lua5.2
/usr/local/bin/luac
/usr/local/bin/luac-5.2
/usr/local/bin/luac5.2
/usr/local/bin/luarocks
/usr/local/bin/luarocks-5.2
/usr/local/bin/luarocks-admin
/usr/local/bin/luarocks-admin-5.2
/usr/local/etc/bash_completion.d/_brew_services
/usr/local/etc/fonts/conf.d/10-hinting-slight.conf
/usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
/usr/local/etc/fonts/conf.d/20-unhint-small-vera.conf
/usr/local/etc/fonts/conf.d/30-metric-aliases.conf
/usr/local/etc/fonts/conf.d/30-urw-aliases.conf
/usr/local/etc/fonts/conf.d/40-nonlatin.conf
/usr/local/etc/fonts/conf.d/45-latin.conf
/usr/local/etc/fonts/conf.d/49-sansserif.conf
/usr/local/etc/fonts/conf.d/50-user.conf
/usr/local/etc/fonts/conf.d/51-local.conf
/usr/local/etc/fonts/conf.d/60-latin.conf
/usr/local/etc/fonts/conf.d/65-fonts-persian.conf
/usr/local/etc/fonts/conf.d/65-nonlatin.conf
/usr/local/etc/fonts/conf.d/69-unifont.conf
/usr/local/etc/fonts/conf.d/80-delicious.conf
/usr/local/etc/fonts/conf.d/90-synthetic.conf
/usr/local/include/lauxlib.h
/usr/local/include/lua.h
/usr/local/include/lua.hpp
/usr/local/include/lua5.2
/usr/local/include/luaconf.h
/usr/local/include/lualib.h
/usr/local/opt/qt5
Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
brew install harfbuzz mono
Run `brew missing` for more details.
This is the output when running brew config:
HOMEBREW_VERSION: 1.6.9-39-g376f67b
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 376f67bf2c8893a06bf1e42a2375d58e9d8c2670
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 69b99b69ff3a9c686b9d9fb0102927c5dd2f373b
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.1 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_131
macOS: 10.14-x86_64
CLT: 10.0.0.0.1.1529074627
CLT headers: 10.0.0.0.1.1529074627
Xcode: 10.0 => /Applications/Xcode-beta.app/Contents/Developer
XQuartz: 2.7.11 => /opt/X11
I had the same problem.
I was able to fix it by completely uninstalling and reinstalling Python after following step by step in this answer: How to fix broken python 2.7.11 after OSx updates
After the reinstallation the problem was gone
As I read you output - this is not a problem with python directly it is a problem with sphinx which builds the docs. I would go for the following steps:
brew update && brew upgrade
brew install sphinx (maybe this gives a better error message or solves the problem if sphinx is installed before)
brew reinstall python#2
If this is not working: Did you reinstalled the commandline tools after upgrading to mac os 10.14? (xcode-select --install). If not installed/updated before do it and retry.
If this all is not working could you please execute brew doctor and post the output so we can better see whats going on with your homebrew instane?
Maybe it could be a option to make an roll back to a stable version of Mac OS (10.13) ?
I'd suggest you used the Anaconda Distribution of python. Anaconda offers both python 2.7 and python 3.6 with easy to use python installers for both versions. The Anaconda page explains how to install and run python on your mac.

python, pyenv and recompiling to handle a 64bit issue?

I have pyenv, and i want to use python 3.4.1 against apache.
To that end, I have installed mod_wsgi 4.2.7
In compiling mod_wsgi, I get the following error:
Object_NextNotImplemented' can not be used when making a shared object; recompile with -fPIC
/root/.pyenv/versions/3.4.1/lib/libpython3.4m.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1
According to this page the issue is something to do with a 64bit or a 32 bit or... I don't know.
Anyway, the solution is to re-compile python with some sort of flag.
How do i resolve this issue, bearing in mind that i am using pyenv?
This is not the solution, i still get the same error after having done this
PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared"
pyenv uninstall 3.4.1
pyenv install 3.4.1
so the first line - i didn't think would actually work, I don't know what it is doing. I guess it is just setting some magic system variable somewhere? Oh well, it is doing that.
I don't know what the unicode bit does - this was all suggested in this link here.
Becuase i am wanting to use python 3.4.1, and because it already exists, i then uninstall python 3.4.1
Then i reinstall python 3.4.1
If you wanted to do the same with python x.y.z, you would similarly have
PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs4 --enable-shared"
pyenv uninstall x.y.z
pyenv install x.y.z
If you had not installed x.y.z python earlier, um, then you wouldn't need to uninstall it.
This whole installation process takes... a while. I started writing this answer right after i kicked off the install command, and it only recently finished.
On finishing i get
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.4.1 to /root/.pyenv/versions/3.4.1
But i don't know if that is bad or good. The prompt itself doesn't seem to know either, what with all those question marks around.

NVM fails to install any version of Node.js in Cygwin

I've already learned that Node.js opted out of supporting Cygwin in the newer version, but NVM can't install the older version either. The error I'm getting:
$ nvm install v0.4.12
Additional options while compiling:
######################################################################## 100.0%
C:\Python27\python.exe: can't open file '/home/wvxvw/.nvm/src/node-v0.4.12/tools\
/waf-light': [Errno 2] No such file or directory
nvm: install v0.4.12 failed!
(formatted for readability)
I think this is because of Python binaries aren't aware of Cygwin-style path (and cannot find /home/ directory) I tried building from sources (same version) and am facing the same problem). I'm not sure however what to do. I wouldn't like to change Python installed in Windows for Python that can be installed through Cygwin. And if this error isn't just the tip of the iceberg, I'd maybe just change the Makefile.
The question is directed to those who might tell whether it makes sense to try to "fix" the Makefile, or should I just use Cygwin's version of Python (its problem is very buggy fork, but I think I could live with that...)
Command is not correct , use version without v. Try : nvm install 0.4.12

Error when trying to uninstall Macports

I'm using this link to uninstall macports and instead install homebrew. However, I run into an error on the first step. I run sudo port -f uninstall installed my terminal (I'm on a mac btw) and it spits this right back at me :
Warning: port definitions are more than two weeks old, consider using selfupdate
Warning: configured user/group macports does not exist, will build as root
---> Uninstalling python27 #2.7.1_3
Error: Target org.macports.uninstall returned: error deleting "/opt/local/var/macports/software/python27/2.7.1_3": directory not empty
Log for python27 is at: /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_python27_2.7.1_3/python27/main.log
Warning: Failed to execute portfile from registry for python27 #2.7.1_3
---> Uninstalling python27 #2.7.1_3
Error: port uninstall failed: error deleting "/opt/local/var/macports/software/python27/2.7.1_3": directory not empty
I'm not really sure what this stuff means and am not very familiar with macports. I don't even think I installed python with macports...
If you are going to remove macports I would then just do the deletetion
sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports
The first warnings you are getting are due to not having the latest version of macports so run the selfupdate. For the error you need to look at the log suggested /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_python27_2.7.1_3/python27/main.log
The reason macports installed python without you asking is probably because you asked for a port that needed to use python. Macports will install its own python so that it knows exactly which version and compile options were used for python, as the developers from long experience with unix vendpors have found that the vendors (e.g. Apple) can change things and cause issues (see latest updates to Xcode for a good example) or not provide later bug fixes which are needed. Homebrew trusts Apple and so would use Apple's versions

Homebrew failing to install postgresql; python 64-bit errors

I'm getting errors when running
$ brew install postgresql
==> Downloading http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.bz2
File already downloaded in /Users/neil/Library/Caches/Homebrew
Warning: Detected a framework Python that does not have 64-bit support in:
/Library/Frameworks/Python.framework/Versions/Current/Python
e configure script seems to prefer this version of Python over any others,
you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
fix this issue, you may need to either delete the version of Python
own above, or move it out of the way before brewing PostgreSQL.
te that a framework Python in /Library/Frameworks/Python.framework is
e "MacPython" version, and not the system-provided version which is in:
/System/Library/Frameworks/Python.framework
==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.2 --datadir=/usr/local/Cellar/postgresql/9.1.2/shar
^C
Here's where python is located.
$ which python
/usr/local/bin/python
I modified my ~/.zshrc PATH from
export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
to
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin
And although I'm getting python 64-bit errors, my version of python is 64-bit according to this SO post:
$ python -c 'import struct;print( 8 * struct.calcsize("P"))'
64
The problem pointed out in the referenced mailing list post is that the configure step isn't impacted by the PATH here. There's a whole other mechanism used to find things to link against; see Where do I set DYLD_LIBRARY_PATH on Mac OS X for a quick intro. You could try the suggested workaround given by the brew script--rename /Library/Frameworks/Python.framework/Versions/Current/Python to something else to get it out of the linker's search path, repeat the brew install, then put it back.
If you don't need Python bindings in your PostgreSQL, you can also just install it without Python bindings using brew install postgresql --no-python.
This command is installing the server, not the python bindings. Is that what you want? There is a installer for osx that will install the server for you.
Once you have done that, you can install the psycopg2 bindings directly from source.

Categories