简体   繁体   中英

installing a python package from tar.gz

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.

  1. When I run the sequence .configure, then make and then sudo make install, none of them works.

  2. 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.

  1. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM