Error importing scipy.linalg on windows (python 3.3) - python

I am using python 3.3 on Windows. I downloaded scipy-0.13.2.win32-py3.3.exe from scipy-lib and installed it. However, when I tried to load scipy.linalg, interpreter displayed the following errors:
>>> import scipy.linalg
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import scipy.linalg
File "C:\Python33\lib\site-packages\scipy\linalg\__init__.py", line 157, in <module>
from .misc import *
File "C:\Python33\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from . import blas
File "C:\Python33\lib\site-packages\scipy\linalg\blas.py", line 131, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
How can I resolve this issue? Between, I checked installed library modules on my PC with the github modules at linealg-scipy and they are latest, so no issue there, I guess.

To fix this issue in both Python 2.7/3, you can install scipy from here
It will work better than the version from this deposit.

Related

Error in running python file using ASE library

I am trying to run a python script using ASE library, I have installed ase (https://wiki.fysik.dtu.dk/ase/install.html)and run my python script using this library on my terminal. I have made a virtual env named 'MLC_env' and have already installed the ase library there.
There is a folder 'Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase' which got installed over there. Now the the website (https://pypi.org/project/ase/) says Add ~/ase to your $PYTHONPATH environment variable and add ~/ase/bin to $PATH (assuming ~/ase is where your ASE folder is).
I am not able to figure out what exactly I have to do? How to add this ase folder to my pythonpath? Any suggestions will be helpful.
I tried to follow this answer Permanently add a directory to PYTHONPATH? , according to this I can try doing export PYTHONPATH="${PYTHONPATH}:/my/other/path"" where ~/ase will be the full path name of the ase folder. Shall I go ahead with this? any suggestions.
Python script
from ase import Atoms
atoms = Atoms('N2')
print(atoms.positions)
Error: While trying to run the above python script
(MLC_env) (base) anshumansinha#Anshumans-MacBook-Pro-3 Q1 % python3 struct.py
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/py3k.py", line 24, in <module>
import pickle5 as pickle
File "/Users/anshumansinha/.local/lib/python3.10/site-packages/pickle5/__init__.py", line 1, in <module>
from .pickle import *
File "/Users/anshumansinha/.local/lib/python3.10/site-packages/pickle5/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
ImportError: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.compat._inspect import getargspec
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/__init__.py", line 12, in <module>
from . import py3k
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/py3k.py", line 26, in <module>
import pickle
File "/Users/anshumansinha/miniforge3/lib/python3.10/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
ImportError: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py", line 17, in <module>
from ase.atom import Atom
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/atom.py", line 3, in <module>
import numpy as np
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/__init__.py", line 141, in <module>
from . import core
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.10 from "/Users/anshumansinha/Desktop/MLC/MLC_env/bin/python3"
* The NumPy version is: "1.24.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)

numpy is installed but I got the error "DLL load failed while importing _multiarray_umath: The specified module could not be found."

I am using the Anaconda distribution with Python 3.9. Among the packages installed, I have numpy, pandas, etc. In PyCharm IDE, I have set the Project Interpreter to be the path to the python.exe installed with Anaconda: C:\Users\nguye\anaconda3\envs[Tensorflow]\pythonw.exe
P.S: I have tried every method to fix this problem on stack overflow from including more paths to uninstall and reinstall but none of those work. Please help!
C:\Users\nguye\anaconda3\envs\[Tensorflow]\pythonw.exe C:/Users/nguye/PycharmProjects/tensorEnv/main.py
Traceback (most recent call last):
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\numpy\core\__init__.py", line 23, in <module>
from . import multiarray
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
from . import overrides
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\numpy\core\overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\nguye\PycharmProjects\tensorEnv\main.py", line 3, in <module>
import tensorflow
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>
from tensorflow.python.eager import context
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\tensorflow\python\eager\context.py", line 26, in <module>
import numpy as np
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\numpy\__init__.py", line 144, in <module>
from . import core
File "C:\Users\nguye\anaconda3\envs\[Tensorflow]\lib\site-packages\numpy\core\__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "C:\Users\nguye\anaconda3\envs\[Tensorflow]\pythonw.exe"
* The NumPy version is: "1.22.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
Process finished with exit code 1

Numpy Library not loading(In face none of the library)

I have installed Python 3.7, and I have been working in Python for a while. It was working all fine and suddenly from this afternoon, I am unable to load any Python libraries. I have tried to uninstall and install entire libraries and Python itself. It has not fixed the issue yet. Could someone help on what else to be looked at. I have been using pip3 to install packages. I am not using Anaconda. I was able to install the package successfully but unable to load for some reason. When I try to load numpy, I am getting below mentioned error
import numpy
Traceback (most recent call last):
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The network path was not found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\chango3\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The network path was not found.
Any help would be appreciated

Error on running exe build using Pyinstaller

Following is the list of modules I am using:
import sys
import cv2
import numpy as np
import pytesseract
from PIL import Image
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.datasets.samples_generator import make_blobs
import re
import jellyfish
Exception
Traceback (most recent call last):
File "c:\python\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "c:\python\lib\site-packages\matplotlib\backends\backend_webagg.py", line 31, in <module>
raise RuntimeError("The WebAgg backend requires Tornado.")
Error on running the generated exe:
File "c:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
File "c:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
ImportError: DLL load failed: The specified module could not be found.
[22724] Failed to execute script main
I have tried the suggested solutions on git links but nothing seems to work. The script itself runs fine. Iam on Windows 10, Python 3.6
I was able to finally resolve the issue by following:
Installing and install tornado and importing tornado as pointed by
Diego Contreras in comments
Following the steps mentioned in the post [How do you resolve 'hidden imports not found!' warnings in pyinstaller for scipy?
Make sure your Microsoft build tools are installed and the dll location is present in PATH(both x86 and x64). Restart the machine after editing PATH variables.

python image not found after paraview brew install

I am runing python scripts on mac and after a "brew install paraview" a lot of packages are not working anymore : import vtk, or import scipy.linalg ...
Here is for example one of the bug:
Would you have an idea how to fix this?
Traceback (most recent call last):
File "MV15.py", line 3, in <module>
import scipy.linalg as slin File "/usr/local/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 159, in <module>
from .misc import * File "/usr/local/lib/python2.7/site-packages/scipy/linalg/misc.py", line 5, in <module>
from . import blas File "/usr/local/lib/python2.7/site-packages/scipy/linalg/blas.py", line 145, in <module>
from scipy.linalg import _fblas ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/linalg/_fblas.so, 2): Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/libgfortran.3.dylib Referenced from: /usr/local/lib/python2.7/site-packages/scipy/linalg/_fblas.so Reason: image not found

Categories