Cannot import scipy in ipython (python 3.4.4) - python-3.x

I have a working setup for Jupyter Notebooks (numpy, scipy, matplotlib, etc.) on workstation 1. I went to set up a second workstation (bash shell on windows 10):
Installed Python 3.4.4 from www.python.org, windows 64 bit.
Upgraded pip: $ python -m pip install --upgrade pip, now its (v 9.0.1)
Installed numpy with pip
Installed scipy with pip
$ pip install scipy
Requirement already satisfied: scipy in c:\python34\lib\site-packages
Requirement already satisfied: numpy>=1.8.2 in
c:\python34\lib\site-packages (from scipy)
See image. When I try to import scipy in ipython I get this '_ccallback_c' error.
I've searched google and this site for importing scipy and this error, but nothing has shown up. Thanks for your help.

As written in the comments, Windows users like myself need to use packages from http://www.lfd.uci.edu/~gohlke/pythonlibs/ (or something alike).
I downloaded the packages I wanted of the correct type (python 3.4, 64 bit windows) and extracted them in my Python>Lib>site-packages folder. Time for data analysis.

Related

Why can't I import scikit-learn from Spyder, but I can import it from the command line?

I installed Spyder 5 for MacOS Big Sur using the standalone installer on the Spyder website (i.e., no Anaconda required). I had been using Spyder 4.2.1 and successfully importing scikit-learn. However, after I installed Spyder 5, I couldn't import scikit-learn, and got a ModuleNotFound error. So I removed the "sklearn" directory from the "Library/Python/2.7/lib/python/site-packages" directory where it was placed, and re-installed scikit-learn with
pip install -U scikit-learn
as it says on the scikit-learn website. I can now import the module from my Mac's terminal command line, but when I try on Spyder, I get a long message that includes
ImportError: dlopen(/Users/my_user_name/Library/Python/2.7/lib/python/site-packages/sklearn/__check_build/_check_build.so, 2): Symbol not found: __PyThreadState_Current
Referenced from: /Users/my_user_name/Library/Python/2.7/lib/python/site-packages/sklearn/__check_build/_check_build.so
Expected in: flat namespace
in /Users/my_username/Library/Python/2.7/lib/python/site-packages/sklearn/__check_build/_check_build.so
as well as
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run python setup.py install or
make in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
What can I do at this point?
you need install Dependencies :
scikit-learn requires:
Python (>= 3.6)
NumPy (>= 1.13.3)
SciPy (>= 0.19.1)
joblib (>= 0.11)
threadpoolctl (>= 2.0.0)
for good result requirements.txt
Note:Scikit-learn 0.20 was the last version to support Python 2.7 and Python 3.4. scikit-learn 0.23 and later require Python 3.6 or newer.
pip install scikit-learn==0.20.4
learn more go to this

Using numpy (and others module)

It's maybe a stupid thing, but I can't resolve it.
I used pip3 to install numpy, scipy... When I rewrote the instruction in command line, it said that
"Requirement already satisfied: numpy in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(1.16.2)"
But when I used Python 3.7.2 it said that
"ModuleNotFoundError: No module named 'numpy'"
So that I cannot use numpy actually. I tried also to remove python, and reinstall it via brew. But nothing happen.
Also, I've got a problem with pip. When I do pip3 install --upgrade pip, it answers
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Jupyterlab Package Directory

I'm having trouble importing pypyodbc in a jupyterlab notebook. I'm able to import it in a shell and even "old" jupyter notebooks. I've tried installing it via pip, conda, and manually. When I run !{sys.executable} -m pip install pypyodbc in the notebook it just shows:
Requirement already satisfied: pypyodbc in
c:~\appdata\local\continuum\anaconda3\lib\site-packages\pypyodbc-1.3.3-py3.6.egg
(1.3.3)
Requirement already satisfied: setuptools in
~\appdata\local\continuum\anaconda3\lib\site-packages
(from pypyodbc) (39.1.0)
I can import other packages just fine, but pypyodbc isn't working. What is the default package directory for jupyterlab, and how can I point it to a specific directory to import packages from?
It's possible you have multiple versions of Python running on your computer and Jupyter is selecting a version that does not have that package. To figure out what version of Python is running in your notebook do this inside Jupyter:
import os
import inspect
inspect.getfile(os)
Then you can run pip on that specific version:
python3.6 -m pip install pypyodbc
Alternatively, you can try to uninstall the package and reinstall via pip if it still doesn't work.

Error intalling scipy for python 3.5

Got an error installing scipy package (see attachement) from prompt. Windows 7, 64bit, Python 3.5.1. Also tryed scipy-0.19.0-cp35-cp35m-win_amd64.whl but got a scipy-0.19.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform response. So how to find the supported wheel? Thanks in advance!
UPDATE: Didn't find the way to install scipy package itself but installed Anaconda and made it as a default PyCharm Python interpreter, scipy imports properly now.
Update you pip
pip install --upgrade pip
And then try
pip install scipy

Installing NumPy on Fedora 24 with pip

My question is perhaps similar to Installing Numpy on Fedora 19 with pip.
I would like to install NumPy with pip on (a freshly installed) Fedora 24.
Fedora already has pip (via the command pip3). When I write pip3 install numpy, pip downloads a zip (with the source code inside) and tries to compile (build a local wheel). But I do not have Python headers so it can't compile. I guess that if I install python3-devel pip will manage to compile NumPy as I already have GCC (but no linear algebra library).
But what I want to do is to install NumPy from a wheel only. Normally if a wheel is available on PyPI, then pip will download the corresponding wheel file. It is so on other distributions: Arch, Ubuntu. I installed the package python3-wheel also, but it didn't have any effect.
Can somebody make the situation clearer?
You need to upgrade your pip.
I've just tried to install numpy on fresh fedora container and pip tried to download sources and compile them, and failed because of python3-devel missing.
But I updated pip with pip3 install --upgrade pip and afterwards pip3 install numpy downloaded numpy-1.11.1-cp35-cp35m-manylinux1_x86_64.whl file and isnstaled it without issues.

Resources