Problem Python 3.9: trying to install package 'PyPortfolioOpt' - python

I tried downloading the 'PyPortfolioOpt' package on my MacBook Pro (iOS 11.0.1) but it always shows an error.
I've downloaded the Xcode developer tools and already upgraded the latest pip3 setup-tools. I am using python 3.9.
The error:
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
ERROR: Failed building wheel for cvxopt
Running setup.py clean for cvxopt
Failed to build cvxopt
Installing collected packages: cvxopt, PyPortfolioOpt
Running setup.py install for cvxopt ... error
ERROR: Command errored out with exit status 1:

For some reason, probably something to do with how new python 3.9 is and how little bug fixes have come out so far, python 3.9 didn't work for me at all. I have upgraded a few times before, but never did it result in as many bugs as when I tried installing python 3.9. I recommend firstly trying $ python3 -m pip install PyPortfolioOpt, and if that doesn't work go back to python 3.8 or 3.7, that's what I'm on now and everything works fine now for me.

Related

How to fix errors occurring on installation of Jupyter Notebook

I am new to Python and try to install Jupyter Notebook from within a Windows command prompt window using:
pip install jupyter
But after a couple of minutes of downloading, an error message is displayed as shown below:
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe
' 'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\
_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\asd\Ap
pData\Local\Temp\tmpnj_hhq6y'
cwd: C:\Users\asd\AppData\Local\Temp\pip-install-_pnki5r8\pywinpty
Complete output (6 lines):
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
Checking for Rust toolchain....
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\asd\appdata\local\progr
ams\python\python38-32\python.exe' 'c:\users\asd\appdata\local\programs\python\p
ython38-32\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata
_for_build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpnj_hhq6y' Check the logs for
full command output.
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.
I have attached here just the last part of the error output.
How to fix this error for a successful installation of Jupyter Notebook?
EDIT1: I installed the Rust package from the link in the error message. After that I tried installing Jupyter Notebook once again, and this time after proceeding a few steps further than before, it output another error:
Building wheels for collected packages: pywinpty
Building wheel for pywinpty (PEP 517) ... - WARNING: Subprocess output does
not appear to be encoded as cp1252
WARNING: Subprocess output does not appear to be encoded as cp1252
error
ERROR: Command errored out with exit status 1:
command: 'c:\users\asd\appdata\local\programs\python\python38-32\python.exe'
'c:\users\asd\appdata\local\programs\python\python38-32\lib\site-packages\pip\_v
endor\pep517\_in_process.py' build_wheel 'C:\Users\asd\AppData\Local\Temp\tmpaj5
u66_y'
cwd: C:\Users\asd\AppData\Local\Temp\pip-install-mep4ye8d\pywinpty
Complete output (60 lines):
Running `maturin pep517 build-wheel -i c:\users\asd\appdata\local\programs\pyt
hon\python38-32\python.exe`
Compiling proc-macro2 v1.0.26
Compiling unicode-xid v0.2.2
Compiling syn v1.0.71
Compiling winapi v0.3.9
Compiling jobserver v0.1.22
error: could not compile `proc-macro2`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
dY'¥ maturin failed
Caused by: Failed to build a native library through cargo
Caused by: Cargo build finished with "exit code: 101": `cargo rustc --messag
e-format json --manifest-path Cargo.toml --release --lib --`
dY\x8d1 Building a mixed python/rust project
dY"- Found pyo3 bindings
dY\x90\x8d Found CPython 3.8 at c:\users\asd\appdata\local\programs\python\pyt
hon38-32\python.exe
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed wi
th the Visual C++ option
error: aborting due to previous error
Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'c:\\users\\asd\\app
data\\local\\programs\\python\\python38-32\\python.exe'] returned non-zero exit
status 1
----------------------------------------
ERROR: Failed building wheel for pywinpty
Failed to build pywinpty
ERROR: Could not build wheels for pywinpty which use PEP 517 and cannot be insta
lled directly
WARNING: You are using pip version 20.2.1; however, version 21.1 is available.
You should consider upgrading via the 'c:\users\asd\appdata\local\programs\pytho
n\python38-32\python.exe -m pip install --upgrade pip' command.
Upgrade your pip first:
pip install --upgrade pip
Then:
pip install jupyter
I'reached this post after failing to install notebook on a 32-bit python 3.8.3 execution. And as far as I found, pywinpty, which is a dependence, does not support 32-bit executions (see sources below).
I solved the problem by installing python on its 64-bit version.
Sources:
How do I determine if my python shell is executing in 32bit or 64bit?
pip install fails on Python 3.8 32-bit, prevents Jupyter install #129 which simply says that wheels cannot be installed with 32 bit Python and that you should use 64 bit Python instead.
We can't generate 32 bit wheels, sorry. Please use a 64bit build of Python.. Was not my case but might be useful this similar issue when using python 3.8 64-bit
Error installing Jupyter & pywinpty (Python)
https://github.com/spyder-ide/pywinpty/issues/123
Do
pip install wheel
and try again. It worked for me.
What to do:
Check if your python is 64-bit version. If no, go to python site (for example, here is the link to download 3.7.9. Just click at the version that has label "for AMD64/EM64T/x64", do it with any version you wish, just I don't like to use the newest version). Remove yours (with the uninstall file) and download this. Don't forget to put the checkmark near "Add PATH" below;
Download Rust (the description is inside) - you need some files. Check the PATHs - if you want to change them, do it (the names of the variables and where they are - both are written, you can search in the Internet how to change PATH var's (for example));
Go to Windows Shell with admin mode (Win+X and you get the field) - here is the most comfortable place to work;
Go to your python.exe (for example, my way is C:\Users\user\AppData\Local\Programs\Python\Python37) - just for sure;
python.exe python -m pip install --upgrade pip;
python.exe pip install jupyter;
If an error was returned that contains the missing of wheel, try to download it: python.exe pip install wheel.
Donwload any library you miss during installation and continue since the step you stopped at.
Try using Anaconda. link to install conda https://www.anaconda.com/products/individual
then cmd : conda install numpy
cmd: conda install jupyter
cmd : jupyter notebook
The error message looks quite clear, you needs to install Cargo via https://rustup.rs/
I have faced the same issue when I'm using vscode. The simplest solution is to use conda instead of pip
conda install jupyterlab

How can i install scikit-image module for Python on Windows properly?

Platform: Windows 10 Pro 20H2, Python 3.8.7
I need to install image-match module, but when install is coming to required scikit-image module, i am recieving error:
Running setup.py install for scikit-image ... error
ERROR: Command errored out with exit status 1:
WARNING: The wheel package is not available.
Surfing Internet i found out that scikit-image module wheel for windows is not available. I tried to install scikit-image with binary .whl file. Looks like module installed and i tried to install image-match again. Now i am recieving this:
Building wheel for image-match (setup.py) ... done
Created wheel for image-match: filename=image_match-1.1.2-py3-none-any.whl size=21230 sha256=bb2a55e18dac36ab10056523f66383756fac637eafe4f12d4e12df9a3da3ad8c
Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\70\62\40\3511b893ee0655b25176450c3b0405caf4ded0f44927de3ebe
Building wheel for scikit-image (setup.py) ... error
ERROR: Command errored out with exit status 1:
Partial import of skimage during the build process.
I am not that good in Python, so what am i doing wrong?
Install directly from Github Link for some reason PyPI has an older version of the branch.
Use this Command pip install git+https://github.com/EdjoLabs/image-match

pip install returns code 1 error with saga_python. Any ideas?

I am trying to install saga-python (package for SAGA GIS) and cmd python keeps returning the same error: python setup.py egg_info failed with code 1 in C:\Users\MyUser\AppData\Local\Temp\pip-build-7uieglh9\saga-python. Any ideas why it occurs?
Also, tried a few tips from this question's answers:
Python pip install gives "Command "python setup.py egg_info" failed with error code 1" not working either.
Version is 3.5.2 and setuptools and ez_setup are allright.
Tried with easy_install as well. No results either, sais that the syntax is invalid.
Also tried with virtualenv and http://docs.python-guide.org/en/latest/dev/virtualenvs/. Error is caused by two different Python versions: 2.7 and 3.5.2. I cannot uninstall 2.7 (shell for some GIS software), but I need to make it work somehow.
This package only for python 2.X. See issue

How to get Python packages installed as .exe to run on Windows 10; "failed to create process"

After installing Python 3.5.1 on Windows 10 x64, cpplint installed from pip produces the error: failed to create process. There seems to be a possibly related issue with pip related to having a space in the path, which exists in my use case. It seems to be related to how the exe is created. How can this error be remedied? Reinstalling Python and cpplint does not solve the problem.
C:\Users>python -V
Python 3.5.1
C:\Users>pip list
pip (7.1.2)
setuptools (18.2)
C:\Users>pip -V
pip 7.1.2 from c:\users\john hagen\appdata\local\programs\python\python35\lib\site-packages (python 3.5)
C:\Users>pip install cpplint
Collecting cpplint
Using cached cpplint-0.0.6.tar.gz
Installing collected packages: cpplint
Running setup.py install for cpplint
Successfully installed cpplint-0.0.6
C:\Users>where.exe cpplint
C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\Scripts\cpplint.exe
C:\Users>cpplint
failed to create process.
Yep, this is a pip bug.
The workaround is to add quotes around the path in the first line of generated python scripts in the \Scripts\ directory. In the case of cpplint this is 'cpplint-script.py'. In your case the generated first line should something like:
#!c:\users\john hagen\appdata\local\programs\python\python35\python.exe
and should be edited to:
#!"c:\users\john hagen\appdata\local\programs\python\python35\python.exe"

Trying to install PyCrypto on Ubuntu via Buildout, src/config.h: No such file or directory

I'm trying to install PyCrypto on an Ubuntu instance via Buildout (via easy_install) and I'm getting the following error:
Getting distribution for 'pycrypto>=1.9'.
Running easy_install:
/usr/bin/python "-S" "-c" "import sys,os;p = sys.path[:];import site;sys.path[:] = p; [sys.modules.pop(k) for k, v in sys.modules.items() if hasattr(v, '__path__') and len(v.__path__)==1 and not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))];from setuptools.command.easy_install import main;main()" "-mUNxd" "/opt/rocktech/buildout/cache/eggs/tmppKIfK7" "-Z" "/opt/rocktech/buildout/cache/download/dist/pycrypto-2.4.tar.gz"
path=/opt/rocktech/buildout/cache/eggs/setuptools-0.6c12dev_r88846-py2.6.egg
Processing pycrypto-2.4.tar.gz
Running pycrypto-2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dD_8Pu/pycrypto- 2.4/egg-dist-tmp-_d3xDl
error: Setup script exited with error: src/config.h: No such file or directory
An error occurred when trying to install pycrypto 2.4. Look above this message for any errors that were output by easy_install.
While:
Installing django.
Getting distribution for 'pycrypto>=1.9'.
Error: Couldn't install: pycrypto 2.4
Any idea on what's causing this?
Notably, I had the same issue locally on Snow Leopard and I was able to fix it by downloading the code directly and running python manage.py build and python manage.py install by hand. I want to avoid that here because I'm deploying to a dozen servers.
Even with the newest pycrypto I keep having this problem, so I just run ./configure and the src/config.h is created, so now just run pip or, easy_install or, setup.py...
You can also download pycrypto-2.4.tar.gz unpack it and run (as root):
./configure
python setup.py install
After that pycrypto will be installed into /usr/lib/python2.7/site-packages/Crypto. I tested it on 'easy_install pysnmp'.
It appears this is an open issue. The workaround is to use pip instead or stick to PyCrypto 2.3. https://bugs.launchpad.net/pycrypto/+bug/881130
EDIT: This bug was fixed in PyCrypto 2.4.1.
Just as an update, PyCrypto has since resolved this issue as you can see from the ticket being marked "Fix Resolved": https://bugs.launchpad.net/pycrypto/+bug/881130. Just an FYI, in case someone comes across this later. This "should" be a non-issue now.

Categories