I need to use the cvxopt package for python 3. I run Ubuntu.
So I downloaded cvxopt-1.1.9.tar.gz and extracted the content (a single folder called cvxopt-1.1.9) into a folder
/home/myname/TargetFolder/
manually, not via the command window.
When I run the sequence .configure, then make and then sudo make install, none of them works.
There is a setup.py file in /home/myname/TargetFolder/cvxopt-1.1.9/. When I go to that directory in the command window and type python setup.py install, then I get the following error message:
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/home/myname/anaconda3/lib/python3.5/site-packages/test-easy-install-6110.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/myname/anaconda3/lib/python3.5/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
That link doesn't exist anymore.
So I follow the advice on http://cvxopt.org/install/ . Apart from the "python setup.py install" command, which didn't work for me, I tried the second thing on their list. Namely "pip install cvxopt"
This gave:
Collecting cvxopt
Downloading cvxopt-1.1.9.tar.gz (1.9MB)
100% |████████████████████████████████| 1.9MB 271kB/s
Building wheels for collected packages: cvxopt
Running setup.py bdist_wheel for cvxopt
Complete output from command /home/myname/anaconda3/bin/python3 -c >"import setuptools;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';>exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpv0ura7txpip-wheel-:
running bdist_wheel
running a lot of other stuff
and then
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Failed building wheel for cvxopt
Failed to build cvxopt
and then
Installing collected packages: cvxopt
Running setup.py install for cvxopt
Complete output from command /home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
UPDATING build/lib.linux-x86_64-3.5/cvxopt/_version.py
set build/lib.linux-x86_64-3.5/cvxopt/_version.py to '1.1.9'
running build_ext
building 'base' extension
and then after some more lines it says:
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Command "/home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-r3o_hfm6/cvxopt
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
If I understood more about Linux and Python I could have focused on the important things and shortened the post a little. But since I know nothing, I post everything I did to maximize the possibility of helpful responses.
Maybe I just don't understand how python works. When I include a package I do this with the
import package
command. But import cvxopt doesn't work. So if I understood what it is exactly doing, then maybe I could use logic to give her or him that cvxopt package, where it is looking for it.
Since you are running Ubuntu, simply run sudo apt-get install python-cvxopt
I can install it this way on 16.04. Not sure what version you are running.
It does look like the compiler (gcc) is complaining because you are missing dependencies (blas). Installing via the package manager should solve your issues.
Related
I'm in the process of trying to get the python module python3-saml working on a cloud foundry app that is using the standard python buildpack and cflinuxfs2 stack. This module relies on the python xmlsec module as a dependency, but I'm unfortunately running into issues with getting it working.
I've put together a requirements file and have vendored all of the python dependencies, but I keep getting the following error when I go to run the "cf push" command.
Running setup.py install for xmlsec: started
Running setup.py install for xmlsec: finished with status 'error'
Complete output from command /tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
*********************************************************************************
Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?
*********************************************************************************
----------------------------------------
Command "/tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lwwtrplp/xmlsec/
pip install has failed. You have a vendor directory, it must contain all of your dependencies.
**ERROR** Could not install pip packages: Couldn't run pip: exit status 1
Failed to compile droplet: Failed to run all supply scripts: exit status 14
Exit status 223
I tried uploading the appropriate libxmlsec1-dev and libxmlsec1 manually and set an environment variable to refer to them, but the staging process appears to just ignore those while it's setting up packages.
Is there anything that I could do to get this process working? I'd imagine there's a custom buildpack out there somewhere that would do the trick, but I wasn't sure if there was a way to do this using the standard python buildpack instead.
The primary option would be to vendor your dependencies. With this option, you build locally and then push all the compiled bits too. The trick is that you have to build on a compatible system, so you need an Ubuntu Trusty PC/VM/Docker container.
Follow these instructions, then run cf push & make sure that you do not have the vendor directory ignored (remove from .cfignore, if it exists).
https://docs.cloudfoundry.org/buildpacks/python/index.html#vendoring
The other option that should work is to use multi-buildpack support. With this you can push using two buildpacks. The first would be the Apt buildpack and the second would be the python buildpack. The Apt buildpack allows you to install the packages that you need, which looks like libxmlsec1-dev. The second is just the standard Python buildpack, but it will have access to what has been installed via the Apt buildpack.
You can see instructions here: https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html
I use this command for installing MySQL client:
pip install mysqlclient
And then I see this problem:
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
Cleaning up... Command C:\Python34\python.exe -c "import setuptools,
tokenize;file='C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient\setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record
C:\Users\Jayed\AppData\Local\Temp\pip-l4c6dhkk-record\install-record.txt
--single-version-externally-managed --compile failed with error code 1 in C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient
Storing debug log for failure in C:\Users\Jayed\pip\pip.log
Actually I went down this path. While I suppose you can find all the libraries and components you need to get the client to compile, it is telling you it can't find a compiled copy of the client and is trying to compile it to install it.
Follow the instructions here: https://pypi.org/project/mysqlclient/ (it has notes about windows doing what you are describing) or download the wheel file (from downloads link on the page) and type
pip install mysqlclient.whl
and it will install without demanding C++ in order to use mysql with python.
I am new to the Wagtail cms and am taking over a friend's project for his site.
I have downloaded his repo and am trying to get it to run locally. I have followed the steps on the wagtail documentation http://docs.wagtail.io/en/v1.12.1/getting_started/index.html
but in the site's requirements.txt file, there are some dependencies that just are not installing and giving errors:
here is the output of when trying to install the requirements:
build\lib.win32-2.7\psycopg2\_psycopg.pyd : fatal error LNK1120: 62 unresolved externals
error: command 'C:\\Users\\Adam\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\link.exe' failed with exit status 1120
Rolling back uninstall of psycopg2
Command "c:\python27\python.exe -u -c "import setuptools,
tokenize;__file__='c:\\users\\Adam\\appdata\\local\\temp\\pip-build-
bykm5e\\psycopg2\\setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,
__file__, 'exec'))" install --record c:\users\Adam\appdata\local\temp\pip-
cidizd-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in c:\users\Adam\appdata\local\temp\pip-
build-bykm5e\psycopg2\
(The full output is here: https://pastebin.com/m1ukkei8)
Any help would be greatly appreciated - I am using Python 2.7 and have tried reinstalling psycopg and have installed postresql
Your windows linker is throwing out errors as you don't have c++ libraries for an extension to be built properly.
I would suggest to you to rather install it through wheel file
by running
pip install some-package.whl
I'm not sure if this is the answer, but the version of psycopg2 that you're using had a bug that prevented installation using pip, due to some bug in pip. Try version 2.5.3 and see if that fixes it.
I am using Python for making a script to work with some chemical structures in my PhD. I want to install openbabel libraries for python. I tried my best but I could not install it. It always gives error:
Error: SWIG failed. Is Open Babel installed?
Here is the Python Path on my PC: C:\Users\malih\AppData\Local\Programs\Python\Python36-32. Openbabel is installed at the following path C:\Program Files (x86)\OpenBabel-2.3.1.
When I run python -m pip install openbabel, it gives the following error:
C:\Users\malih>python -m pip install openbabel
Collecting openbabel
Using cached openbabel-2.4.1.tar.gz
Installing collected packages: openbabel
Running setup.py install for openbabel ... error
Complete output from command C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
Warning: pkg-config could not be found.
Guessing Open Babel location:
- include_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', '/usr/local/include/openbabel-2.0']
- library_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\libs', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\PCbuild\\win32', '/usr/local/lib']
building '_openbabel' extension
swigging openbabel-python.i to openbabel-python_wrap.cpp
swig.exe -python -c++ -small -O -templatereduce -naturalvar -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -I/usr/local/include/openbabel-2.0 -o openbabel-python_wrap.cpp openbabel-python.i
Error: SWIG failed. Is Open Babel installed?
You may need to manually specify the location of Open Babel include and library directories. For example:
python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib
python setup.py install
----------------------------------------
Command "C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\malih\AppData\Local\Temp\pip-build-glr82a7x\openbabel\
I tried to follow the instructions on this page but they are purely for linux and I could not follow up them for Windows:
How do I use python-openbabel in Travis CI?
I also tried to install pkg-config from the following guide but even after that, it gives the same error:
How to install pkg config in windows?
Please help me on this as my work is based on this and I am stuck at this point. Thanks in advance for your time.
pip install is notoriously non-windows friendly. Either go to openbabel website and download + install windows binary, then download + install python binding, or use the unoffical official openbabel python windows build, then cd into the downloaded directory, and perform pip install OPENBABEL_FILE_WINDOWS.whl
I recently had do some quite a bit of work on 2D mol file -> 3D mol file translation using openbabel. Let me know how it works out for you.
--
edit: I should also add, python3.x is breakingly different to python2.x. So if anything breaks, try it with python2.x
This is somewhat old, but the problems still persist so i'll answer nonetheless.
The precompiled Windows binary (most likely) doesn't come with SWIG built-in, which in turn doesn't offer language bindings and gives you the error when installing from pip.
A workaround to this is to install a wheel from the unofficial Windows binaries website just like pandamakes answered.
However, the wheels already comes bundled with a precompiled obabel, so you really don't need to install the windows binaries version (the one that comes with the setup and all), but you have to know that if you're willing to ship a python script that uses this library, know that it will interfere with systems that do have BABEL_DIR in the environment variables, to fix this you have to include the whole openbabel directory from YourPythonDirectory/lib/site-packages/. in your script's folder.
Another important note is that some babel builds from the unofficial binaries website have a bug where they do not detect all file formats, especially the most common ones like sdf/pdb/mol2 or even smiles. The only versions i have confirmed working somewhat flawlessly so far are the openbabel‑3.1.1‑cp36‑cp36m‑win32.whl and openbabel‑3.1.1‑cp38‑cp38‑win32.whl.
I am trying to setup a Python development environment in Visual Studio 2013 using the new PTVS. However, I need to be able to develop in both Python 2.7 and Python 3.3. Here's what I have done so far for both versions:
Installed distribute
Installed pip
Added C:\Python 3.3\Scripts & C:\Python 2.7\Scripts to my Path environment variable.
So in the Scripts folders I have:
easy_install.exe
easy_install-3.3.exe
pip.exe
pip-3.3.exe
easy_install.exe
easy_install-2.7.exe
pip.exe
pip-2.7.exe
Along with the executables are the corresponding python scripts.
Now having done this, I am trying to install a Python module RPi.GPIO, but I am getting the following error message:
C:\Windows\system32>pip-2.7 install RPi.GPIO==0.5.3a
Downloading/unpacking RPi.GPIO==0.5.3a
Downloading RPi.GPIO-0.5.3a.tar.gz
Running setup.py egg_info for package RPi.GPIO
Installing collected packages: RPi.GPIO
Running setup.py install for RPi.GPIO
building 'RPi.GPIO' extension
error: Unable to find vcvarsall.bat
Complete output from command "C:\Program Files\Python 2.7\python.exe" -c "import set
uptools;__file__='c:\\users\\jon\\appdata\\local\\temp\\pip_build_Jon\\RPi.GPIO\\setup.p
y';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install
--record c:\users\jon\appdata\local\temp\pip-svl0a1-record\install-record.txt --single-
version-externally-managed:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\RPi
copying RPi\__init__.py -> build\lib.win-amd64-2.7\RPi
running build_ext
building 'RPi.GPIO' extension
error: Unable to find vcvarsall.bat
----------------------------------------
Cleaning up...
Command "C:\Program Files\Python 2.7\python.exe" -c "import setuptools;__file__='c:\\use
rs\\jon\\appdata\\local\\temp\\pip_build_Jon\\RPi.GPIO\\setup.py';exec(compile(open(__fi
le__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\jon\ap
pdata\local\temp\pip-svl0a1-record\install-record.txt --single-version-externally-manage
d failed with error code 1 in c:\users\jon\appdata\local\temp\pip_build_Jon\RPi.GPIO
Storing complete log in C:\Users\Jon\pip\pip.log
C:\Windows\system32>
It's trying real hard, but it is failing somewhere, and I can't trace it back to the source. Likewise, I always get the error: Unable to find vcvarsall.bat know matter what module I try to install. What would cause this?
I have tried removed one of the interpreters path from the environment variables, because I thought that the duplicate easy_install.exe instances might be conflicting. Making this change didn't help.
Should the install be nearly as simple as:
pip-2.7 install RPi.GPIO==0.5.3a
or
pip-3.3 install RPi.GPIO==0.5.3a
UPDATE: I just tried install RPi.GPIO by using the command:
pip-3.3 install RPi.GPIO
and it was successfully installed, but the version is way out of date. Hm..?