I believe this may be a general python/gcc problem not specific to pyglpk.
I'm trying install to pyglpk on a fresh install of Ubuntu 14.04. As I'm using a fresh install of Ubuntu both Python 2.7 and 3 are installed.
I believe I've properly installed the listed required dependencies (GLPK and GMP) and I've installed the additional dependencies which another post suggested I might be missing:
apt-get install python-dev libxml2-dev libxslt-dev
Here is the error i get when trying to compile pyglpk:
sudo make
python setup.py build
running build
running build_ext
building 'glpk' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -Isrc -I/usr/include/python2.7 -c src/glpk.c -o build/temp.linux-x86_64-2.7/src/glpk.o -m32
In file included from /usr/include/python2.7/Python.h:8:0,
from src/glpk.c:20:
/usr/include/python2.7/pyconfig.h:7:49: fatal error: i386-linux-gnu/python2.7/pyconfig.h: No such file or directory
# include <i386-linux-gnu/python2.7/pyconfig.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [all] Error 1
It looks to me like the actual file it's looking for (pyconfig.h) is here:
/usr/include/x86_64-linux-gnu/python2.7/pyconfig.h
while make/gcc seems to be looking for the equivalent file for 32 bit python:
/usr/include/i386-linux-gnu/python2.7/pyconfig.h
I'm going to try installing 32 bit Ubuntu instead, even though I should be able to use 32 bit programs on a 64 bit system. I'll report back here.
Thanks!
I have finally gotten PyGLPK working!
I was able to "solve"fatal error: i386-linux-gnu/python2.7/pyconfig.h: No such file or directory by installing 32 bit Ubuntu instead of 64 bit.
I would not recommend trying to install the 32 bit version of python on 64 bit Ubuntu as that opens up another huge plethora of issues.
If you know how to fix this error on 64 bit Ubuntu please speak up!
Once I got past that error I experienced a new error:
ImportError: libglpk.so.0: cannot open shared object file: No such file or directory
I discovered that part of this error is the due to PyGLPK being quite old. The newest version of PyGLPK (v. 0.3) is not compatible with the newest version of GLPK (v 4.58). This post suggested GLPK v 4.47 was the last working version compatible with PyGLPK, which seems to be working fine.
After installing GLPK v 4.47 the error still appears to occur. I've found that installing python-glpk using the command sudo apt-get install python-glpk fixes the error. I believe this is because installing python-glpk also installs some dependency which is also necessary for PyGLPK, because even after uninstalling python-glpk PyGLPK continues to work.
I can confirm that following this step while using GLPK v. 4.58 does not work. An older version of GLPK and whatever dependency python-glpk installs are both required.
I had the exact same error/situation (64 bit linux mint, I'm sorry if its somehow different, total noob here). GLPK 4.55. This version works out the box:
https://github.com/bradfordboyle/pyglpk
Hope this helps.
Related
I seem to be one of the many people struggling to install gensim on windows. I have trawled through countless forums but the errors poster there never appear to match my errors. So hopefully someone can point me in the right direction!
I am running Windows Server 2012 R2 Standard 64-bit. I have installed MinGW & Anaconda 2.2.0 (64-bit), which comes with Python 2.7.9.
I have added a file distutils.cfg into C:\Users\Sam\Anaconda\Lib\distutils with the contents:
[build]
compiler=mingw32
I have added C:\MinGW\bin to my Environment variables.
If I install gensim using pip I do not get any errors, until I try to run Word2Vec when I get the error:
C:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\gensim\models\word2vec.py:459: UserWarning: C extension com
pilation failed, training will be slow. Install a C compiler and reinstall gensim for fast training.
So I have uninstalled gensim and tried to re-install using the mingw32 compiler, but this gives me this error:
python setup.py build --compiler=mingw32
c:\users\sam.passmore\appdata\local\continuum\anaconda\lib\site-packages\setuptools-14.3-py2.7.egg\setuptools\dist.py:282: UserWarni
ng: Normalizing '0.11.1-1' to '0.11.1.post1'
running build
running build_ext
building 'gensim.models.word2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/word2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o
gcc: error: ./gensim/models/word2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.word2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed.")
building 'gensim.models.doc2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/doc2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\doc2vec_inner.o
gcc: error: ./gensim/models/doc2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.doc2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed."
I have exhausted all options I can think of or find, so if anyone could give some advice it would be much appreciated.
I managed to solve this after using conda install for gensim, rather than pip.
conda install gensim
I am not sure what other steps I have included above have contributed to the answer, but this was the last thing I did before I no longer was getting the 'Install a C compiler and reinstall gensim for fast training.' message.
During my research in trying to solve this problem I saw that the most common methods were adding the lines
[build]
compiler=mingw32
to the distutils.cfg file as well as ensuring MinGW is in your path. Also ensuring that the MinGW bit version is the same as your python version.
I'd like to start by saying that asking a question here isn't something I do lightly. I've now been attempting to install Pygame 1.9.1 from source for four hours, and I've run into several problems but was able to overcome each one. This is the first one I'm completely stumped on.
After I unpack pygame-1.9.1release.tar.gz and cd to the folder, I run 'python3 setup.py install'
/Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL_syswm.h:58:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
After some online research, I read that X11 is no longer included with OSX 10.9, so I installed XQuartz in the hope that it could serve as a replacement.
Xquartz does include 'Xlib.h', but it's filepath is /opt/X11/include/X11/Xlib.h, and the setup script doesn't find it here. I've tried several ways to fix this.
The error process specifically comes up in the build part of the install. I've tried using
python3 setup.py config --include-dirs /opt/X11/include
as well as
python3 setup.py config --include-dirs /opt/X11/include/X11
but get the same error.
I read online that installing the Xcode command line tools could fix this problem. I'm ~95% sure I had the command line tools before, but I tried to get them again anyway with 'xcode-select --install' only to be told that 'Can't install the software because it is currently unavailable from the Software Update server'. "No problem," I tell myself and just download the package from the Mac developers site. It doesn't help anything.
I've also tried symlinking with the command
sudo ln -s /usr/include/X11 /opt/X11/include/X11
Of everything I've tried, I understand this the least, do I could very well be doing the symlink command wrong.
Two other commands I tried are
export C_INCLUDE_PATH=/opt/X11/include
export CPLUS_INCLUDE_PATH=/opt/X11/include
Just looking at the documentation, I came across a debug option for the startup script.
The output of 'python3 setup.py build -g' is
running build
running build_py
running build_ext
building 'pygame.display' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -g -Ddarwin -I/Library/Frameworks/SDL.framework/Versions/Current/Headers -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c src/display.c -o build/temp.macosx-10.6-intel-3.3/src/display.o
In file included from src/display.c:30:
/Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL_syswm.h:58:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
I'm not sure what else I can do, but I'd really appreciate some help with this. Thanks in advance!
setup.py build|install commands accepts CFLAGS and LDFLAGS compiler options, as far as I know.
Thus here, you can do
CFLAGS=-I/opt/X11/include python3 setup.py install
You probably need the LDFLAGS as well; I'm not sure about the exact location, but something like
CFLAGS=-I/opt/X11/include LDFLAGS=-L/opt/X11/lib python3 setup.py install
seems logical.
After that, you may have to set your DYLD_LIBRARY_PATH to point to your X11 libraries. In case your installation proceeds but your PyGame script won't run and complains about not finding X11 libraries. Thus
export DYLD_LIBRARY_PATH=/opt/X11/lib
As for the symbolic link you tried to create: it's the wrong way 'round: the two paths should have been switched, so I guess you got an error because /opt/X11/include/X11 already exists. But with the above, no symlink is necessary.
I ran into a similar error when trying to install pygame into my PyCharm project's virtualenv. I solved it by cding to the SDL Framework directory where the error originated and copying the X11 header files into it:
$ cd /Library/Frameworks/SDL.framework/Versions/Current/Headers
$ cp -R /opt/X11/include/X11 ./
then $ pip install pygame ran without errors.
I can't seem to be able to get the python ldap module installed on my OS X Mavericks 10.9.1 machine.
Kernel details:
uname -a
Darwin 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
I tried what was suggested here:
http://projects.skurfer.com/posts/2011/python_ldap_lion/
But when I try to use pip I get a different error
Modules/LDAPObject.c:18:10: fatal error: 'sasl.h' file not found
*#include sasl.h
I also tried what was suggested here:
python-ldap OS X 10.6 and Python 2.6
But with the same error.
I am hoping someone could help me out here.
using pieces from both #hharnisc and #mick-t answers.
pip install python-ldap \
--global-option=build_ext \
--global-option="-I$(xcrun --show-sdk-path)/usr/include/sasl"
A workaround
/usr/include appears to have moved
$ xcrun --show-sdk-path
$ sudo ln -s <the_path_from_above_command>/usr/include /usr/include
Now run pip install!
In my particular case, I couldn't simply use the pip arguments noted in other answers because I'm using it with tox to install dependencies from a requirements.txt file, and I need my tox.ini to remain compatible with non-Mac environments.
I was able to resolve this in much simpler fashion: exporting CFLAGS such that it adds an include path to the sasl headers already installed by Xcode:
$ pip install python-ldap
...
building '_ldap' extension
creating build/temp.macosx-10.10-x86_64-2.7
creating build/temp.macosx-10.10-x86_64-2.7/Modules
clang -fno-strict-aliasing -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.19 -IModules -I/opt/openldap-RE24/include -I/usr/include/sasl -I/usr/include -I/Users/bc/.pyenv/versions/2.7.10/include/python2.7 -c Modules/LDAPObject.c -o build/temp.macosx-10.10-x86_64-2.7/Modules/LDAPObject.o
Modules/LDAPObject.c:18:10: fatal error: 'sasl.h' file not found
#include <sasl.h>
^
1 error generated.
error: command 'clang' failed with exit status 1
$ export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include/sasl"
$ pip install python-ldap
...
Successfully installed python-ldap-2.4.19
Depending on whether or not you use any userspace-friendly Python tools (I use pyenv), you may have to prefix your pip commands with sudo.
I had the same problem. I'm using Macports on my Mac and I have cyrus-sasl2 installed which provides sasl.h in /opt/local/include/sasl/. You can pass options to build_ext using pip's global-option argument. To pass the include PATH to /opt/local/include/sasl/sasl.h run pip like this:
pip install python-ldap --global-option=build_ext --global-option="-I/opt/local/include/sasl"
Alternatively you could point it to whatever the output from xcrun --show-sdk-path provides. On my box that's:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
Then you need to determine the PATH to the sasl header files. For me that's:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sasl/
Let me know if that helps or you need a hand.
I used a combination of posts I found about this problem (including this one) to eventually come up with this (copied from a larger script):
export XC_SDK=$(xcrun --show-sdk-path)
export USR_INC=$XC_SDK/usr/include
export PATH=$USR_INC:$PATH
echo "installing python-ldap"
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install python-ldap
You can test it with python -c "import ldap"
The main reason I didn't follow the advice of #hharnisc was that on my local machine /usr/local had not moved, so I just temporarily put $XC_SDK before it on the path, and that seems to work.
some sources:
how to install PIL on Macosx 10.9?
I got this error when running buildout.
I fixed it, first finding the sasl.h file:
mdfind -name sasl.h
then defining the corresponding CFLAGS environment variable:
export CFLAGS="-I/opt/local/include/sasl"
and finally running buildout again.
G'day everyone,
I am trying to install PyGraphviz 1.2 on OSX Mavericks. I have just upgraded from Mountain Lion and now have Xcode 5.0.1 installed with Command Line Tools. I have downloaded the PyGraphviz source package, unpacked it and ran sudo python setup.py install.
I am getting the following error message (there is some output prior to this, including several warnings):
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/pygraphviz/graphviz_wrap.o -L/usr/local/lib/graphviz -L/usr/local/lib/graphviz -lcgraph -lcdt -o build/lib.macosx-10.9-intel-2.7/pygraphviz/_graphviz.so
ld: library not found for -lcgraph
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Also, the first two lines of output are:
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
which leads me to believe that compiler knows where to look for libraries.
What could be the problem? Just to make things clear: for technical reasons I have to use Apple's version of Python 2.7 and everything works fine on my other machine with OSX Lion and Xcode 4... (not sure what the exact version is).
I had a same error and resolved it by installing command line tools for XCode. Assuming you upgraded your XCode to 5.0.1, you can install command line tools by typing "xcode-select --install" to terminal and it will prompt you to install command line tools.
I would like to install the ephem package in my Python 3.3.0 version under Windows XP.
I tried first the pip install ephem route from the system command prompt. The process aborted with the error message of Unable to find vcvarsall.bat.
I read prior advice on the net for such a difficulty. Following it I installed mingw32 in my computer, added C:\MinGW\bin to the PATH variable and provided Lib / distutils with a new file called distutils.cfg and the content:
[build]
compiler=mingw32
On running now any of the install commands (pip, *easy_install* and setup.py all work the same) the following error results:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ilibastro-3.7.5 -IC:\Python33\
include -IC:\Python33\include -c extensions/_libastro.c -o build\temp.win32-3.3\
Release\extensions\_libastro.o
cc1.exe: error: unrecognised command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I have tried to understand and solve the problem, but have been unsuccesful. I have not been able even to find the place in the code where such values are established.
¿Could somebody provide any help? ¿Would ephem be one of the cases alluded by Installing Python modules in the 3.3.0 Documentation with "Not all extensions can be built with MinGW or Cygwin, but many can."?
Thanks in advance
Paco
Here is an extremely useful page of Windows binaries of python packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/.
It includes binaries for pyephem.