Scipy install help windows 10 - python-3.x

I am trying to get scipy running on my computer and I have been fighting for the last few hours with it. Currently, im running python 3.6 and I am on windows 10. I first tried to install it using pip which failed no matter what I did. Then I went and downloaded the wheel file and installed it manually using pip. Then I used pip to get the rest of the dependencies like the website stated pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose. It installed the rest of the packages just fine.
If I say in IDEL
import scipy
It will give me an error of
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from scipy import special, optimize
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\__init__.py", line 116, in <module>
from scipy._lib._ccallback import LowLevelCallable
File "C:\Users\Kevin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in <module>
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'
if I go in that file to comment out that line, it will import but it after that I get a lot more errors anytime I try and do anything.
Also, I tried installing anaconda as a dependency manager and that seemed to work fine for installing, but if I tried to used Atom or IDLE as my text editor it can't seem to find scipy when its compiling and throws and error. I am kinda at a loss and any advice or help on this would be much appreciated. Thank you in advance.

Related

64bit MacOs After succesfully installing Pygame: ModuleNotFoundError: No module named 'pygame'

Python noob here. I've been trying to install pygame and pandas for a few hours now. Even with Conda I did not succeed. I have Python 3.8.5 installed.
I eventually tried through the terminal with these commands:
python -m pip install pygame==2.0.0.dev6
and
python -m pip install pandas
(this was a total guess by the way, but apparently it did something)
Results were succesfull:
Requirement already satisfied: pygame==2.0.0.dev6 in /opt/miniconda3/lib/python3.8/site-packages (2.0.0.dev6)
and
Successfully installed numpy-1.19.2 pandas-1.1.2 python-dateutil-2.8.1 pytz-2020.1
But, when I try to import either modules, I still get errors. Any ideas?
import pygame
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
import pandas
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
Do I need to move the modules to the script folder or something? Or what do I even move? Thanks!
Ok.. Got it thanks to #matt.. after succesfully installing pygame, find the environment in which pygame is installed by entering 'which python'.
In my case it returned:
/opt/miniconda3/bin/python
Now I needed to make sure the VS console was pointing at the same environment, by checking which python interpreter it was using and selecting the correct one. More info:
how to check and change environment in VS Code

Having problems installing python-docx

>>> import docx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\users\kevin\mu_code\docx\__init__.py", line 3, in <module>
from docx.api import Document # noqa
File "c:\users\kevin\mu_code\docx\api.py", line 14, in <module>
from docx.package import Package
File "c:\users\kevin\mu_code\docx\package.py", line 9, in <module>
from docx.opc.package import OpcPackage
File "c:\users\kevin\mu_code\docx\opc\package.py", line 9, in <module>
from docx.opc.part import PartFactory
File "c:\users\kevin\mu_code\docx\opc\part.py", line 12, in <module>
from .oxml import serialize_part_xml
File "c:\users\kevin\mu_code\docx\opc\oxml.py", line 12, in <module>
from lxml import etree
ImportError: cannot import name 'etree'
I have python-docx 0.8.10 and lxml 4.5.0, windows 10. I tried googling already but I'm not sure if I followed the suggestions correctly or if it's applicable in my case (lxml problems). I haven't had any problems installing other modules using "pip install" so I'm stuck and don't know how to proceed from here.
Check this,
Use pip install, to install the docx library and if you have already install it successfully then have a look into its dependencies. I think it is because of the incompatibility with its dependencies that is why you are getting the error.
pip install python-docx
Dependencies
Python 2.6, 2.7, 3.3, or 3.4
lxml >= 2.3.2
I don't know whether this may be an appropriate solution for you. But this is what I generally follow. Just install Anaconda in your system and an environment according to your needs. For your case create an environment for Python 3.4 using the following command
conda create --name py34 python=3.4
You then install libraries according to your needs in the respective environment. Now you can work into each environment without interfering with the libraries of the other environment. To use anaconda kindly follow Anaconda cheatsheet.
Kindly refer to the link. Hope this helps you.
This is almost certainly a problem with the lxml install. python-docx works with all versions of Python >= 2.6.
Instead of import docx, try from lxml import etree. If this produces the same error message, you know you've narrowed it down.
lxml depends on a couple of C libraries, lib2xml and libxslt if I remember correctly. These are sometimes tricky to install. In any case, you'll find solutions to those problems by searching on "lxml install windows" or similar.
Once from lxml import etree works without error I think you'll find import docx does too.

ImportError while importing sklearn

I am using python 3.7
Recently I started getting this error while importing sklearn module.
I get the same error in Jupyter Notebook, Python IDLE, Pycharm virtual environment
>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\__init__.py", line 75, in <module>
from .utils._show_versions import show_versions
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\utils\_show_versions.py", line 12, in <module>
from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: DLL load failed: The specified module could not be found.
I have tried reinstalling too.
After that I copied contents of sklearn of venv of another project which had no issues. This thing worked for couple of times. But now it's not working again
Note: pandas, numpy, scipy etc are installed and working absolutely fine. Sklearn was also working fine few days back
This is an issue in the packaging in scikit-learn 0.22.0 which will be solved in 0.22.1 (released next week). The issue is tracked at: github.com/scikit-learn/scikit-learn/issues/15899. There are 2 possible workarounds:
Install scikit-learn from conda-forge (conda include the missing dll) by default: conda install conda-forge::scikit-learn
Install VC++ which will have the openmp library (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)

Error importing sklearn in python [duplicate]

I'm trying to call a function from the cluster module, like so:
import sklearn
db = sklearn.cluster.DBSCAN()
and I get the following error:
AttributeError: 'module' object has no attribute 'cluster'
Tab-completing in IPython, I seem to have access to the base, clone, externals, re, setup_module, sys, and warning modules. Nothing else, though others (including cluster) are in the sklearn directory.
Following pbu's advice below and using
from sklearn import cluster
I get:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from sklearn import cluster
File "C:\Python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module>
from .spectral import spectral_clustering, SpectralClustering
File "C:\Python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module>
from ..utils import check_random_state, as_float_array
File "C:\Python34\lib\site-packages\sklearn\utils\__init__.py", line 16, in <module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Python34\lib\site-packages\sklearn\utils\class_weight.py", line 7, in <module>
from ..utils.fixes import in1d
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I'm using Python 3.4 on Windows, scikit-learn 0.16.1.
You probably don't use Numpy+MKL, but only Numpy.
I had the same problem and reinstalling Numpy with MKL
pip install --upgrade --force-reinstall "numpy‑1.16.3+mkl‑cp37‑cp37m‑win32.whl"
fixed it.
Note: update the file to the latest version, possibly 64bit - see the list of available Windows binaries
Problem was with scipy/numpy install. I'd been using the (normally excellent!) unofficial installers from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Uninstall/re-install from there made no difference, but installing with the official installers (linked from http://www.scipy.org/install.html) did the trick.
I am using anaconda got the same error as the OP, when loading Orange, or PlotNine.
I can't recall when this start to happen.
Tracing the dependency of Anaconda3\Lib\site-packages\scipy\special\_ufuncs.cp36-win32.pyd, libifcoremd.dll and libmmd.dll are missing in DependencyWalk. Searching them in anaconda root directry, they are located in both ICC_RT and one version of MKL package.
Adding Anaconda3\pkgs\mkl-2017.0.3-0\Library\bin to PATH, seems to fix SciPy and NumPy related DLL load failure, the above package starts to work again.
I still don't know how to fix this properly. Apparently the downside is that the MKL package could be updated and versions may change so does the path. In this aspect Its equally inconvenient as adding a non-managed package.
Reinstalling ICC_RT fixed the issue for me, libmmd.dll and the related dlls are automatically copied into anaconda3/library/bin afterwards, which is automatically added into PATH by activate command. All previous numpy/scipy related cant load DLL errors are gone now.
From the error log, it shows that scipy module is the most recent module fails to import
File "C:\Python34\lib\site-packages\sklearn\utils\fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\__init__.py", line 109, in <module>
from .isolve import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
from .iterative import *
File "C:\Python34\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
I have the same error that show the same log, the problem'd gone when I uninstall/install scipy:
pip uninstall scipy
pip install scipy
Place this line on top of the python file
from sklearn import cluster
That should do it :))
For me what fixed it were these commands:
pip uninstall sklearn
pip uninstall scikit-learn
pip uninstall scipy
pip install scipy
pip install scikit-learnhere
I had the same issue and solved it by installing/updating the mkl package:
conda install mkl
or
pip install mkl
Just for full information, this also downgraded the following packages:
The following packages will be UPDATED:
mkl: 2017.0.4-h6d528fc_0 defaults --> 2018.0.3-1 defaults
The following packages will be DOWNGRADED:
numpy: 1.11.3-py34_0 defaults --> 1.10.1-py34_0 defaults
pandas: 0.19.2-np111py34_1 defaults --> 0.18.1-np110py34_0 defaults
scikit-learn: 0.18.1-np111py34_1 defaults --> 0.17-np110py34_1 defaults
scipy: 0.19.1-np111py34_0 defaults --> 0.16.0-np110py34_0 defaults
I struggled trying to figure this one out; tried to download and install the (unofficial) Numpy+MKL library from the website (risky/tedious?).
Ultimately found success by:
Login to command prompt using admin rights; how to here: https://superuser.com/questions/968214/open-cmd-as-admin-with-windowsr-shortcut
Uninstall existing/tangled version of Scipy & Numpy
pip uninstall scipy
pip uninstall numpy
Fresh install Scipy & Numpy
pip install scipy
pip install numpy
Run Jupyter notebook; it worked for me.
The message ImportError: DLL load failed: The specified module could not be found
informs that there is failure to identify and source the required DLL(s) to use the scikit-learn library; a fresh install of scipy/numpy probably enables a better routing of DLL connections called from Jupyter notebook code(s).
download microsoft visual c++ distribution
link : https://www.microsoft.com/en-in/download/details.aspx?id=53840
vc_redist.x64.exe
install and run this .exe file in your computer.. the DLL import module error will not appear after this
now it will work fine enjoy :)

Error while starting new IPython console in Spyder

While I was training a neural network with Pybrain, my computer crashed and I had to reboot it. Now Spyder, Python, IPython seem to work fine, however, when trying to open a new IPython console in Spyder, I get the following error:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "C:\Users\Mi\Anaconda3\lib\site‑packages\spyderlib\widgets\externalshell\start_ipython_kernel.py", line 167, in
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\__init__.py", line 48, in
from .core.application import Application
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\core\application.py", line 22, in
from IPython.config.application import Application, catch_config_error
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\config\__init__.py", line 6, in
from .application import *
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\config\application.py", line 19, in
from IPython.config.configurable import SingletonConfigurable
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\config\configurable.py", line 14, in
from IPython.utils.text import indent, wrap_paragraphs
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\utils\text.py", line 28, in
from IPython.external.path import path
File "C:\Users\Mi\Anaconda3\lib\site‑packages\IPython\external\path\__init__.py", line 2, in
from path import *
File "C:\Users\Mi\Anaconda3\lib\site‑packages\path.py", line 122, in
__version__ = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable
The error does not seem to interfere with the execution of Python scripts however I am wondering if I accidentally messed something up. I searched the internet but found nothing that could explain this error.
I am using Python 3.4.3 64 bit with the Anaconda 2.3.0 distribution.
Either upgrade setuptools or try
pip install --upgrade --force setuptools fixed it. Either one or the other should fix the problem.
The accepted answer is correct in that it is a setup tools problem, but I couldn't use pip install --upgrade --force setuptools, that complained about not being able to find easy-install.pth
Instead I was able to upgrade setuptools using easy-install itself with:
easy_install --upgrade setuptools, hope that helps someone who was stuck like me.
I have the same problem. and setuptools did not fix my error.
finally, run
conda update path.py
fix my error. You could check this link: https://github.com/spyder-ide/spyder/issues/2679
conda update qt pyqt
conda update spyder
pip install -U spyder
This worked for me

Resources