"pip install scipy" failed in Travis CI python 3.7 env - python-3.x

I have problem to setup my project in Travis CI python 3.7 environment, although simply running with 'pip install scipy' in python 3.6 works fine. There lots of similar/same problems and solutions reported before [1], but answers does not work for me.
Can anyone help to explain why it works with python 3.6 [2], while failed with python 3.7 in Travis CI server ?
I finally tried with the following scripts, but it still does not work in Travis CI (python 3.7) env. Travis CI (python 3.6 and python 3.6 dev) still work fine.
python -m pip install --upgrade pip
pip install --upgrade pip setuptools wheel
sudo apt-get build-dep python-scipy
sudo apt-get install -qq python-scipy
pip install scipy
...
[1] https://github.com/travis-ci/travis-ci/issues/2890
[2] https://travis-ci.org/jerrygaoLondon/jgtextrank/jobs/323822420
Errors:
Building wheels for collected packages: scipy
Running setup.py bdist_wheel for scipy ... error
Complete output from command /home/travis/virtualenv/python3.7-dev/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j7d10poq/scipy/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/tmp2u1cz0lipip-wheel- --python-tag cp37:
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['/home/travis/virtualenv/python3.7-dev/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
...
For more details of the error, please check out https://travis-ci.org/jerrygaoLondon/jgtextrank/jobs/323822422

There are no binary wheels yet for Python 3.7 (the list is on https://pypi.python.org/pypi/scipy) so pip downloads the source package for SciPy and attempts to compile it. This fails most of the time because you need a full development environment for Python and the assorted libraries (BLAS and LAPACK with development headers), see https://scipy.org/install.html and https://github.com/scipy/scipy/blob/master/INSTALL.rst.txt .
Your solutions:
Roll back to Python 3.6, which I would suggest.
Make sure to install the development libraries for Python 3.7 and the libraries (+ headers) for BLAS and LAPACK.

Related

distutils.errors.DistutilsError: Command . . . returned non-zero exit status 1 [duplicate]

Here are the commands I am running:
$ python setup.py bdist_wheel
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
$ pip --version
pip 1.5.6 from /usr/local/lib/python3.4/site-packages (python 3.4)
$ python -c "import setuptools; print(setuptools.__version__)"
2.1
$ python --version
Python 3.4.1
$ which python
/usr/local/bin/python
Also, I am running a mac with homebrewed python
Here is my setup.py script:
https://gist.github.com/cloudformdesign/4791c46fe7cd52eb61cd
I'm going absolutely crazy -- I can't figure out why this wouldn't be working.
Install the wheel package first:
pip install wheel
The documentation isn't overly clear on this, but "the wheel project provides a bdist_wheel command for setuptools" actually means "the wheel package...".
I also ran into the error message invalid command 'bdist_wheel'
It turns out the package setup.py used distutils rather than setuptools.
Changing it as follows enabled me to build the wheel.
#from distutils.core import setup
from setuptools import setup
Update your setuptools, too.
pip install setuptools --upgrade
If that fails too, you could try with additional --force flag.
I also ran into this all of a sudden, after it had previously worked, and it was because I was inside a virtualenv, and wheel wasn’t installed in the virtualenv.
Update your pip first:
pip install --upgrade pip
for Python 3:
pip3 install --upgrade pip
Throwing in another answer: Try checking your PYTHONPATH.
First, try to install wheel again:
pip install wheel
This should tell you where wheel is installed, eg:
Requirement already satisfied: wheel in /usr/local/lib/python3.5/dist-packages
Then add the location of wheel to your PYTHONPATH:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.5/dist-packages/wheel
Now building a wheel should work fine.
python setup.py bdist_wheel
It could also be that you have a python3 system only.
You therefore have installed the necessary packages via pip3 install , like pip3 install wheel.
You'll need to build your stuff using python3 specifically.
python3 setup.py sdist
python3 setup.py bdist_wheel
Cheers.
I tried everything said here without any luck, but found a workaround.
After running this command (and failing) : bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Go to the temporary directory the tool made (given in the output of the last command), then execute python setup.py bdist_wheel. The .whl file is in the dist folder.

Cannot install Scipy in FreeBSD 13 with Python 3.10

I am trying install scipy in FreeBSD 13. I have built python 3.10 on FreebSD 13 and managed to install pandas, matplotlib and numpy on a virtual environment which has python 3.10. However, when I try to install sklearn or scipy I get an error saying scipy could not be installed.
Here it is below for when doing pip install scipy. I get the same error more or less when trying to install sklearn.
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects
Command errored out with exit status 1: /home/schroter/.pymain/dataViz/bin/python3 /tmp/pip-standalone-pip-d3nnvp2f/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xp_669rf/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.
My pip list is as below:
(dataViz) schroter#SCHROTER:~ % pip list
Package Version
---------------- -------
cycler 0.11.0
kiwisolver 1.1.0
matplotlib 3.4.3
numpy 1.21.4
pandas 1.3.4
Pillow 8.4.0
pip 21.3.1
pyparsing 3.0.6
python-dateutil 2.8.2
pytz 2021.3
semantic-version 2.8.5
setuptools 58.5.3
setuptools-rust 0.12.1
six 1.16.0
toml 0.10.2
wheel 0.37.0
Would anyone be able to help me in this regards please?
Thanks & Best Regards
Schroter
Reuse system package
# install system-wide version in site-packages
doas pkg install py38-scipy-1.8.0
# create a virtualenv with site-packages included
python -m venv --system-site-packages .venv
Drawback is you'll get all packages from site-packages, however you can tackle that by
doas pkg install py38-scipy-1.8.0
python -m venv .venv
YOUR_PYTHON_VERSION= SET IT HERE
ln -s $(python -c 'import lxml, os.path; print(os.path.dirname(lxml.__file__)') ./.venv/lib/$YOUR_PYTHON_VERSION/site-packages
borrowed from https://stackoverflow.com/a/13719417
Regular Installation (TODO)
Haven't figured out it yet, but maybe someone else will, so putting here 2 links which might be helpful
https://forums.freebsd.org/threads/python-scipy-with-python3-x-on-freebsd-11.59009/
https://reviews.freebsd.org/D23447
Have you tried to install scipy from freebsd ports? The freebsd ports contain patches to make the code compile on FreeBSD.

Can't install Ta-Lib with pip in Ubuntu 18.04

I need to install the TA-Lib library on python. Where I run the following:
pip install TA-Lib --user
I get this error code:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-52h2r7l4/TA-Lib/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-meoq431k/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-52h2r7l4/TA-Lib/
I have also tried:
pip3 install TA-Lib
when I run:
python --version
I get:
Python 2.7.15rc1
Then I run:
python3 --version
I get:
Python 3.6.7
I can't understand. I have Ubuntu 18.04. Before I have Anaconda, then delete it (hope I delete it correctly) And then install Python 2.7 because I wanted to use Zipline to backtest some strategies, but I cannot use TA-Lib.
Hope someone know the problem, thank you!
I've downloaded TA-Lib-0.4.17.tar.gz that pip3 gets automatically. Opened it - there is no TA-Lib, only wrapper for it. According to its README.md
Dependencies
To use TA-Lib for python, you need to have the TA-Lib already installed. You should probably follow their installation directions for your
platform, but some suggestions are included below for reference.
Mac OS X
$ brew install ta-lib
Windows
Download ta-lib-0.4.0-msvc.zip and unzip to C:\ta-lib
This is a 32-bit release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library.
Some unofficial (and unsupported) instructions for building on 64-bit Windows 10, here for reference:
Download and Unzip ta-lib-0.4.0-msvc.zip
Move the Unzipped Folder ta-lib to C:\
Download and Install Visual Studio Community 2015
Remember to Select [Visual C++] Feature
Build TA-Lib Library
From Windows Start Menu, Start [VS2015 x64 Native Tools Command Prompt]
Move to C:\ta-lib\c\make\cdr\win32\msvc
Build the Library nmake
Linux
Download ta-lib-0.4.0-src.tar.gz and:
$ untar and cd $ ./configure --prefix=/usr $ make $ sudo make install
If you build TA-Lib using make -jX it will fail but that’s OK! Simply rerun make -jX followed by [sudo] make install.
ta-lib depends on their C implementation you have to install it before installing the python version.

pyrebase install on windows Python 3.7 fails

I just installed python 3.7 64 bits on windows 10 for all u
sers and modified the PATH
I updated the pip to 18.1
I installed pygame, with
py -3 -m pip install pygame
it works fine
I wanted to install pyrebase with
py -3 -m pip install pyrebase
Download fine then I have this msg and the pip log dir is erased, so I can't figure out what is hapenning
Command ""C:\Program Files\Python37\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\mine\AppData\Local\Temp\pip-install-2rr8v7jh\pycryptodome\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\mine\AppData\Local\Temp\pip-record-om6lqxmm\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\mine\AppData\Local\Temp\pip-install-2rr8v7jh\pycryptodome\
but before it gives this error
Installing collected packages: pycryptodome, pyrebase
Found existing installation: pycryptodome 3.7.0
Uninstalling pycryptodome-3.7.0:
Successfully uninstalled pycryptodome-3.7.0
Running setup.py install for pycryptodome ... error
this is when I tried to install pycryptodome, which installed well alone, but when trying to install pyrebase it uninstall the previous pycryptodome and try it own but fails.
Any advice? thanks
Edit:
I tried
pip install --upgrade setuptools
as suggested in https://github.com/thisbejim/Pyrebase/issues/179
but it didn't solve my issue
I am still having an error, on Windows10, python 3.7:
Installing collected packages: pycryptodome, pyrebase Running
setup.py install for pycryptodome ... error
Complete output from command "C:\Program Files\Python37\python.exe" -u -c "import setuptools,
tokenize;file='C:\Users\...\AppData\Local\Temp\pip-install-a9kop2nb\pycryptodome\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...\AppData\Local\Temp\pip-record-dm88ctzw\install-record.txt
--single-version-externally-managed --compile:
To install https://github.com/thisbejim/Pyrebase
I needed to download the .zip file (or Git) than manually install it after modifying the setup.py by specifying the latest 'pycryptodome==3.7.3'
then copy the pyrebase\ directory to my python install
c:\WPy-3710\python-3.7.1.amd64\Lib\site-packages\
but the previous comment of #silkindustry showed me a new lib/Wrapper: Pyrebase4
https://github.com/nhorvath/Pyrebase4
that install easily with
pip3 install pyrebase4
Just upgrade setuptools (Successfully installed setuptools-40.6.3) with your suggested command and install newer version of Pyrebase. (Pyrebase4).
I had the same issue. I solved it using the following steps.
pip install pycryptodome
and then I ran
pip install pyrebase
I faced the same issue when I was working with Anaconda which runs python 3.7 as its default python interpreter. So I created a virtual environment with Python 3.6 with
conda create --name env_name python=3.6
Then with conda activate env_name activate the environment and run pip install pyrebase
and it should be installed.
As Lotfi said, go to the pyrebase repository, https://github.com/thisbejim/Pyrebase and download the .zip file of git repository and then edit as he said,then save the /pyrebase folder to site packeges folder, if you still found no module error(Crypto) then visit this link, ImportError: No module named Crypto.Cipher
first install pycryptodome version 3.10.1
pip install pycryptodome==3.10.1
then install pyrebase4
pip install pyrebase4
It work for me
I couldn't solve the issue although I tried the above solutions.
Finally I can install pyrebase like following.
Re-install Python at C:\Pyton. : To avoid searching error of C:\Users...
Install JWS manually. Specify file format by UTF8 at setup.py file.
Install pycryptodomex not pycryptodome.
When make Project check following "inherit global site-packages"
i also faced the same issue with Anaconda, then i solved it by opening the command prompt of Anaconda and type the following,
pip install pycryptodome and then i ran
pip install pyrebase4, these two commands help to clear the issue
If your are using Pycharm you can install the pyrebase5 or any other modules directly from it without getting any error.
Go to Files
Open the settings(Ctrl+Alt+s if you're using Win10)
Go to the Project >> project interpreter
Now you can see all the packages installed in the root folder of python.
(Make sure your your project interpreter is selected to the python root folder :
C:\Users\ (Username)\AppData\Local\Programs\Python\Python38-32
In project interpreter you can see the +(Install) sign in the right. Click on it
the available packages window id open
Now you can search any packages you want to install like pyrebase: you can see all the versions of the pyrebase.
select the package and install package.
This worked for me.
Step 1: Follow the answer given by Nayan and answer by Lotfi. But use 'pycryptodome==VERSION_OF_PYCRYPTODOME_YOU_HAVE_ALREADY_INSTALLED'.Ex. 'pycryptodome==3.10.1'
Step 2: After that Go to the site-packages/Pyrebase folder with updated setup.py file.
Step 3: Install the Pyrebase library from that folder. For that use command
python setup.py install
That's it!
I solved my problem with the 2 steps below. I hope this is going to solve yours as well.
uninstall pyrebase:
pip uninstall pyrebase
Install Pyrebase-t:
pip install Pyrebase-t
The only thing that worked for me was deactivating the virtual environment and reactivating it before trying
pip install pyrebase

Can't install mercurial package with pip under python-3.2

I try to install mercurial with pip package manager with command:
pip.exe install mercurial -I --install-option="--c2to3"
and get such error:
Downloading/unpacking mercurial
Running setup.py egg_info for package mercurial
setup.py with python3 needs --c2to3 (experimental)
Complete output from command python setup.py egg_info:
setup.py with python3 needs --c2to3 (experimental)
----------------------------------------
Command python setup.py egg_info failed with error code 1
How to pass "--c2to3" option to setup.py correctly via pip options?
System: Server2008R2 SP1, python-3.2.3(AMD64)
Mercurial isn't supported on Python 3.x. Install it under Python 2.7 (unless you want to help port it)

Resources