Python Forum

Full Version: trouble installing python package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Trying to install pyportfolioopt but got errors. Can anyone suggest what I should do?

Output:
(base) xxx@xxx-Satellite-P55-A:~$ pip install pyportfolioopt Collecting pyportfolioopt Using cached https://files.pythonhosted.org/packages/46/55/7d39d78d554ee33a7317e345caf01339da11406c28f18bc48794fe967935/PyPortfolioOpt-1.4.1-py3-none-any.whl Collecting cvxpy<2.0.0,>=1.1.10 (from pyportfolioopt) Requirement already satisfied: pandas>=0.19 in ./anaconda3/lib/python3.7/site-packages (from pyportfolioopt) (0.24.2) Requirement already satisfied: scipy<2.0,>=1.3 in ./anaconda3/lib/python3.7/site-packages (from pyportfolioopt) (1.6.2) Requirement already satisfied: numpy<2.0,>=1.12 in ./anaconda3/lib/python3.7/site-packages (from pyportfolioopt) (1.20.2) Collecting scs>=1.1.6 (from cvxpy<2.0.0,>=1.1.10->pyportfolioopt) Collecting osqp>=0.4.1 (from cvxpy<2.0.0,>=1.1.10->pyportfolioopt) Using cached https://files.pythonhosted.org/packages/4d/86/b96693d3f4501afb8a527858764383fc9a192c9f9f020bdf90dbdaf669b4/osqp-0.6.2.post0-cp37-cp37m-manylinux1_x86_64.whl Requirement already satisfied: ecos>=2 in ./anaconda3/lib/python3.7/site-packages (from cvxpy<2.0.0,>=1.1.10->pyportfolioopt) (2.0.7.post1) Requirement already satisfied: python-dateutil>=2.5.0 in ./anaconda3/lib/python3.7/site-packages (from pandas>=0.19->pyportfolioopt) (2.8.0) Requirement already satisfied: pytz>=2011k in ./anaconda3/lib/python3.7/site-packages (from pandas>=0.19->pyportfolioopt) (2018.9) Collecting qdldl (from osqp>=0.4.1->cvxpy<2.0.0,>=1.1.10->pyportfolioopt) Using cached https://files.pythonhosted.org/packages/ec/a3/db0e7c9fec5387dc33cbd2819329c141ba76497148aa9fab4bd1a7c2a279/qdldl-0.1.5.post0.tar.gz Requirement already satisfied: six>=1.5 in ./anaconda3/lib/python3.7/site-packages (from python-dateutil>=2.5.0->pandas>=0.19->pyportfolioopt) (1.12.0) Building wheels for collected packages: qdldl Building wheel for qdldl (setup.py) ... error Complete output from command /home/xxx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-opaot0pp/qdldl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-8udmhpx5 --python-tag cp37: running bdist_wheel running build running build_ext -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Floats are OFF -- Long integers (64bit) are ON -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip-install-opaot0pp/qdldl/c/build Scanning dependencies of target qdldlobject [ 6%] Building C object qdldl/CMakeFiles/qdldlobject.dir/src/qdldl.c.o [ 6%] Built target qdldlobject Scanning dependencies of target qdldlamd [ 13%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_1.c.o [ 20%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_2.c.o [ 26%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_aat.c.o [ 33%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_control.c.o [ 40%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_defaults.c.o [ 46%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_info.c.o [ 53%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_order.c.o [ 60%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_post_tree.c.o [ 66%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_postorder.c.o [ 73%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_preprocess.c.o [ 80%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_valid.c.o [ 86%] Building C object CMakeFiles/qdldlamd.dir/amd/src/SuiteSparse_config.c.o [ 93%] Building C object CMakeFiles/qdldlamd.dir/amd/src/perm.c.o /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘permute_x’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:23:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int j = 0 ; j < n ; j++) x[j] = b[P[j]]; ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:23:5: note: use option -std=c99 or -std=gnu99 to compile your code /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘permutet_x’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:28:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int j = 0 ; j < n ; j++) x[P[j]] = b[j]; ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘pinv’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:33:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int k = 0; k < n; k++) pinv[p[k]] = k; /* invert the permutation */ ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘update_A’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:88:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int i = 0; i < Anz; i++) Apermx[AtoAperm[i]] = Anewx[i]; ^ make[3]: *** [CMakeFiles/qdldlamd.dir/amd/src/perm.c.o] Error 1 make[2]: *** [CMakeFiles/qdldlamd.dir/all] Error 2 make[1]: *** [CMakeFiles/qdldlamd.dir/rule] Error 2 make: *** [qdldlamd] Error 2 building 'qdldl' extension creating build creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/cpp gcc -pthread -B /home/xxx/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ic -Ic/qdldl/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/include/python3.7m -c cpp/qdldl.cpp -o build/temp.linux-x86_64-3.7/cpp/qdldl.o -O3 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] gcc -pthread -B /home/xxx/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ic -Ic/qdldl/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/include/python3.7m -c cpp/wrapper.cpp -o build/temp.linux-x86_64-3.7/cpp/wrapper.o -O3 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] creating build/lib.linux-x86_64-3.7 g++ -pthread -shared -B /home/xxx/anaconda3/compiler_compat -L/home/xxx/anaconda3/lib -Wl,-rpath=/home/xxx/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/cpp/qdldl.o build/temp.linux-x86_64-3.7/cpp/wrapper.o /tmp/pip-install-opaot0pp/qdldl/c/build/out/libqdldlamd.a -o build/lib.linux-x86_64-3.7/qdldl.cpython-37m-x86_64-linux-gnu.so g++: error: /tmp/pip-install-opaot0pp/qdldl/c/build/out/libqdldlamd.a: No such file or directory error: command 'g++' failed with exit status 1 ---------------------------------------- Failed building wheel for qdldl Running setup.py clean for qdldl Failed to build qdldl Installing collected packages: scs, qdldl, osqp, cvxpy, pyportfolioopt Running setup.py install for qdldl ... error Complete output from command /home/xxx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-opaot0pp/qdldl/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-record-9ev1t5fx/install-record.txt --single-version-externally-managed --compile: running install running build running build_ext -- Floats are OFF -- Long integers (64bit) are ON -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip-install-opaot0pp/qdldl/c/build [ 6%] Built target qdldlobject [ 13%] Building C object CMakeFiles/qdldlamd.dir/amd/src/perm.c.o /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘permute_x’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:23:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int j = 0 ; j < n ; j++) x[j] = b[P[j]]; ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:23:5: note: use option -std=c99 or -std=gnu99 to compile your code /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘permutet_x’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:28:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int j = 0 ; j < n ; j++) x[P[j]] = b[j]; ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘pinv’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:33:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int k = 0; k < n; k++) pinv[p[k]] = k; /* invert the permutation */ ^ /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c: In function ‘update_A’: /tmp/pip-install-opaot0pp/qdldl/c/amd/src/perm.c:88:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (QDLDL_int i = 0; i < Anz; i++) Apermx[AtoAperm[i]] = Anewx[i]; ^ make[3]: *** [CMakeFiles/qdldlamd.dir/amd/src/perm.c.o] Error 1 make[2]: *** [CMakeFiles/qdldlamd.dir/all] Error 2 make[1]: *** [CMakeFiles/qdldlamd.dir/rule] Error 2 make: *** [qdldlamd] Error 2 building 'qdldl' extension creating build creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/cpp gcc -pthread -B /home/xxx/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ic -Ic/qdldl/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/include/python3.7m -c cpp/qdldl.cpp -o build/temp.linux-x86_64-3.7/cpp/qdldl.o -O3 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] gcc -pthread -B /home/xxx/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ic -Ic/qdldl/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/lib/python3.7/site-packages/pybind11/include -I/home/xxx/anaconda3/include/python3.7m -c cpp/wrapper.cpp -o build/temp.linux-x86_64-3.7/cpp/wrapper.o -O3 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] creating build/lib.linux-x86_64-3.7 g++ -pthread -shared -B /home/xxx/anaconda3/compiler_compat -L/home/xxx/anaconda3/lib -Wl,-rpath=/home/xxx/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/cpp/qdldl.o build/temp.linux-x86_64-3.7/cpp/wrapper.o /tmp/pip-install-opaot0pp/qdldl/c/build/out/libqdldlamd.a -o build/lib.linux-x86_64-3.7/qdldl.cpython-37m-x86_64-linux-gnu.so g++: error: /tmp/pip-install-opaot0pp/qdldl/c/build/out/libqdldlamd.a: No such file or directory error: command 'g++' failed with exit status 1 ---------------------------------------- Command "/home/xxx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-opaot0pp/qdldl/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-record-9ev1t5fx/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-opaot0pp/qdldl/
I would suggest contacting the author here: [email protected] who may be able to pinpoint the problem quicker.