Cannot install Scipy in FreeBSD 13 with Python 3.10 - scikit-learn

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.

Related

Modules installed globally not found in VS Code Jupyter Notebook

I've installed several Python modules from PyPi globally on Mac OS using pip3. Running pip3 list confirms that they are installed:
user#users-MacBook-Pro SER-neural-net % pip3 list
Package Version
------------------ ---------
appdirs 1.4.4
audioread 3.0.0
...
librosa 0.9.2
numpy 1.23.4
pip 22.3.1
scikit-learn 1.1.3
scipy 1.9.3
sklearn 0.0.post1
sounddevice 0.4.5
soundfile 0.11.0
torch 1.13.0
...
From the integrated terminal in VS Code where I am running the notebook, I have run the following commands to determine which Python interpreter to use:
user#users-MacBook-Pro SER-neural-net % which pip3
/usr/local/bin/pip3
user#users-MacBook-Pro SER-neural-net % which python3
/usr/local/bin/python3
user#users-MacBook-Pro SER-neural-net % python3 --version
Python 3.7.9
I have selected the appropriate interpreter at the top right of Jupyter Notebook view in VS Code:
But the modules confirmed to be installed for this interpreter are not found:
What has gone wrong?
use this:
python3 -m pip install --user (library)
for example:
python3 -m pip install --user pandas

I can't install python modules on Apple Silicon

I have macbook air m1 and I can't install python modules like numpy, matplotlib.
I install python3.8 with homebrew then install virtaulenv. In venv, when I run 'pip install numpy' the error shows up:
'... ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly'
I tried 'pip install --upgrade pip setuptools wheel' doesn't work. Please help.
Install python 3.9.1 from python.org (ARM version)
Then, for Numpy:
python3 -m pip install cython
python3 -m pip install --no-binary :all: --no-use-pep517 numpy==1.20rc1
Then, for matplotlib:
brew install libjpeg
python3 -m pip install matplotlib
This works for me on a Mac min with Apple Silicon.
No luck for SciPy yet, though.

Confusion Regarding pip and conda environment

I am trying to install the twint library into a conda virtual environment. I have to use pip because the library is not at the conda or conda forge channels. twint requires Python 3.6, so I created a new virtual environment with that version. I created that environment following Anaconda's instructions:
conda create --name py36 python=3.6
Again following Anaconda's instructions, I install pip to that environment. A weird thing, I believe, happens here, which is that I am told pip is already installed.
MacBook-Pro-89:~ Zack$ conda install -n py36 pip
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata .........
Solving package specifications: ..........
# All requested packages already installed.
# packages in environment at /Users/Zack/anaconda/envs/py36:
#
pip 20.0.2 py_2 conda-forge
Whether I check my pip version (which -a pip) from the py36 environment or not, I am shown the following:
(py36) MacBook-Pro-89:~ Zack$ which -a pip
/Users/Zack/anaconda/bin/pip
/Users/Zack/anaconda/bin/pip
/Users/Zack/anaconda/bin/pip
/Users/Zack/anaconda/bin/pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
If I try to install twint, it errors out at multidict. The error message is very long, so below I show the top and bottom, which shows something about Python 3.5.
ERROR: Command errored out with exit status 1:
command: /Users/Zack/anaconda/bin/python /Users/Zack/anaconda/lib/python3.5/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/56/sdxbs4_x1xlgyb_9vg9mkn300000gn/T/pip-build-env-exnpi3i_/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'pip>=18' 'setuptools>=40' wheel
cwd: None
[DELETED BY ME FOR THIS ANSWER]
ERROR: Command errored out with exit status 1: /Users/Zack/anaconda/bin/python /Users/Zack/anaconda/lib/python3.5/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/56/sdxbs4_x1xlgyb_9vg9mkn300000gn/T/pip-build-env-exnpi3i_/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'pip>=18' 'setuptools>=40' wheel Check the logs for full command output.
I have tried with pip3 as well, same error.
I have also tried cloning the twint project from github and installing using the requirements file, but I get a similar error to what I'm seeing already:
ERROR: Package 'twint' requires a different Python: 3.5.2 not in '>=3.6.0'
I do not think it is a PYTHONPATH issue, as I don't believe I ever set it.
MacBook-Pro-89:~ Zack$ echo $PYTHONPATH
MacBook-Pro-89:~ Zack$ source activate py36
(py36) MacBook-Pro-89:~ Zack$ echo $PYTHONPATH
(py36) MacBook-Pro-89:~ Zack$
I am pretty sure that I do not have pip in the py36 environment I created, which somehow means it tries using Python 3.5. What I don't understand is that I do have pip in a py35 environment I created. I also do not have this problem on a remote desktop I use, where again pip does exist in the Python 3.6 environment. So there is something funky going on with my py36 environment on my laptop.
Based on the helpful comments below, I have tried the following but also to no avail. See the comments for my responses.
install -y python=3.6 pip conda
which pip
/Users/Zack/anaconda/bin/pip
python -m pip twint
/Users/Zack/anaconda/envs/py36/bin/python: No module named pip
I am using a 2016 Macbook Pro with OS X El Capitan. xcode is updated.
What am I doing wrong?!?! Why won't this work?!?!
I see you are having troubles installing pip. An alternative way of installing pip is through get-pip.py
https://pip.pypa.io/en/stable/installing/
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
Now you can use pip install
python -m pip install pip --upgrade
python -m pip install twint

pip install not working -- How to install/upgrade PyPi packages with pip v10 and above, using Python?

After upgrading my pip to version 10 using pip3 install --upgrade pip and above I cannot I want to install/upgrade PyPi packages using pip3 install PyPiPackageName as I get the following error:
from pip import main
ImportError: cannot import name main
I wonder how I can install PyPi packages using pip when I'm using new versions of pip? I've seen some people use pyhton3 to do this but doing python3 -m pip install --upgrade pip gave me the following error and I cannot upgrade pip to higher versions:
/usr/bin/python3: No module named pip
Before doing python3 -m pip install --upgrade pip I do python3 -m pip install -U pip and I get the following error:
/usr/bin/python3: No module named pip
So I'm confused on what I need to do to be able to upgrade or install PyPi packages.
In addition to executing the following:
curl https://bootstrap.pypa.io/get-pip.py | python3.6
I also had to make sure python3 is using Python 3.6 otherwise Python 3.5 is used (which does not come with pip by default). So I did the following and things work fine now:
ln -s /usr/bin/python3.6 /usr/local/bin/python3

Can someone help me in installing python package "Prophet" on windows 10

Can someone help me in installing python package "Prophet" on windows 10 .
I tried installing python 3.5 and the dependency 'pystan' but yet I get below error.
"The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted.This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand.Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.
Command "python setup.py egg_info" failed with error code 1 in c:\users\suman\appdata\local\temp\pip-build-aqoiqs\fbprophet\"`
I spent a good two days on this issue, finally, I found the following solution
1) Download and install Anaconda 3 (for python 3.6)
2) Create an environment and call it whatever you like
3) Run that environment (which will open the command prompt)
4) follow the following steps in command prompt : (commands are shown in bold)
python -m pip install -U pip
Requirement already up-to-date: pip in c:\users\william\anaconda3\envs\testtime\lib\site-packages
conda install -c conda-forge pystan
Fetching package metadata ...............
Solving package specifications: .
Package plan for installation in environment C:\Users\William\Anaconda3\envs\Testtime:
The following NEW packages will be INSTALLED:
backports: 1.0-py36_1 conda-forge
backports.functools_lru_cache: 1.4-py36_1 conda-forge
ca-certificates: 2017.11.5-0 conda-forge
cycler: 0.10.0-py36_0 conda-forge
cython: 0.27.3-py36_0 conda-forge
freetype: 2.7-vc14_1 conda-forge [vc14]
icc_rt: 2017.0.4-h97af966_0
icu: 58.2-vc14_0 conda-forge [vc14]
intel-openmp: 2018.0.0-hd92c6cd_8
jpeg: 9b-vc14_2 conda-forge [vc14]
libpng: 1.6.34-vc14_0 conda-forge [vc14]
matplotlib: 2.1.0-py36_0 conda-forge
mkl: 2018.0.1-h2108138_4
numpy: 1.13.3-py36ha320f96_0
openssl: 1.0.2m-vc14_0 conda-forge [vc14]
pyparsing: 2.2.0-py36_0 conda-forge
pyqt: 5.6.0-py36_4 conda-forge
pystan: 2.17.0.0-py36_vc14_0 conda-forge [vc14]
python-dateutil: 2.6.1-py36_0 conda-forge
pytz: 2017.3-py_2 conda-forge
qt: 5.6.2-vc14_1 conda-forge [vc14]
sip: 4.18-py36_1 conda-forge
six: 1.11.0-py36_1 conda-forge
tornado: 4.5.2-py36_0 conda-forge
zlib: 1.2.11-vc14_0 conda-forge [vc14]
pip install fbprophet
I also had several issues installing prophet on my Windows 10 machine using conda and Python 3.7.
The following steps made it work:
Create a fresh conda environment
Install pystan and other dependencies using conda install numpy cython matplotlib scipy pandas -c conda-forge (see https://pystan2.readthedocs.io/en/latest/windows.html#steps)
Install prophet using conda install prophet -c conda-forge
In then still had a numpy error Importing the numpy c-extensions failed... as described here: https://numpy.org/devdocs/user/troubleshooting-importerror.html But this was due to my IDE which is VS Code as I could successfully run my prohet model using the command line with the activated conda environment.
So please also make sure to test the installation from the command line in order to rule out that the error stems from you IDE.
Not sure if the same trick would work on Windows, anyways posting w.r.t what just worked on RHEL 7, f.w.i.w
Motivation was installing fbprophet using conda:
conda install -c conda-forge fbprophet
and, it could install pystan==2.17.1.0 and fbprophet==0.6
So, the trick was:
uninstall the pystan package when you had earlier run pip3 install fbprophet, basically one needs to execute the following:
pip3 install pystan==2.17.1.0
pip3 install fbprophet==0.6
And one can thereby import fbprophet in python3 terminal, so working :)
I currently have a fairly vanilla install of Python 3.5 on my Windows 10 machine that I setup using Anaconda.
I was able to install Prophet using the below command, that might work for you. Depending on how your installed Python you may need to run the below command in a cmd shell that was opened as administrator.
pip install prophet
Whenever I have tried to install fbprophet package multiple issues have come.I will suggest a few steps, hopefully they should work.
Close all existing Python / R running instances. If possible restart the machine. I have seen to work as few libraries / dependencies which I want to update might be getting used by existing running instances.
Use anaconda prompt.
First install pystan -
`conda install pystan`
Now install fbprophet
'conda install -c conda-forge fbprophet
Hopefully it should work for you. Also, ensure you have admin rights.
I faced the same issue and my solution was to:-
Create a new environment with Python3.5
conda create -n pht python=3.5 anaconda
Install Prophet using the command.
conda install -c conda-forge fbprophet
I didn't install 'gcc' although this was advised before installing Prophet.

Resources