ImportError with scipy misc - python-3.x

when I run this code :
from scipy.misc import imread, imsave, imresize
first = imread('aa.jpg')
sec = imresize(first, (3000,3000))
imsave('aaa.jpg',sec)
it shows error :
File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs
ImportError: DLL load failed: The specified module could not be found.
how can I solve this problem ????!
please help
Note : I also installed pillow

This typically a symptom of a broken scipy installation. Best reinstall it, using whatever means you used for i stalling it in first place.

Related

Can't get the Datasets library to install in Python 3

I'm trying to install the datasets package (from Huggingface). Everything seems to be working, but when I try to actually import it
from datasets import load_dataset
I get an error in
import pyarrow
import pyarrow.lib as _lib
Specifically:
ImportError: DLL load failed: The specified procedure could not be found.
I've tried reinstalling it multiple times, through Pip, Pip3, Conda. I tried reinstalling pyarrow. Nothing seems to make it work. That said, the error message was different before.
Interestingly, when I try upgrading Pip, I keep getting
WARNING: Ignoring invalid distribution -yarrow
Any idea what I can do to make it work?
Many thanks

Installation of numpy through Anaconda

getting up to speed on Anaconda, I keep receiving an error message when I try to import 'numpy' into Python.
Here is what I have done so far:
Downloaded anaconda from anaconda.com (64-Bit Graphical
Installer (466 MB) with Python 3.7 for Windows);
Installed anaconda (under C:\Users\'Username'\Anaconda3 | Option 'Register Anaconda3 as my default Python 3.7')
Now I'm trying to import numpy into Python using idle.exe, which produces following error message:
Warning: os.path.expanduser("~") points to
h:\,
but the path does not exist.
Futhermore, after executing "'import 'numpy;" in IDLE I get the following error message.
Unfortunately none of the advice was helpful. Numpy seems to be properly installed.
Warning (from warnings module): File "C:\Users\'Username'\Anaconda3\lib\site-
packages\numpy\__init__.py", line 140
from . import _distributor_init
UserWarning: mkl-service package failed to import, therefore Intel(R) MKL
initialization ensuring its correct out-of-the box operation under condition
when Gnu OpenMP had already been loaded by Python process is not assured.
Please install mkl-service package, see http://github.com/IntelPython/mkl-
service
Traceback (most recent call last):
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\__init__.py",
line 24, in <module>
from . import multiarray
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\multiarray.py",
line 14, in <module>
from . import overrides
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\overrides.py",
line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\'Username'\Anaconda3\Scripts\myscripts\import_test.py", line 1,
in <module>
import numpy
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\__init__.py", line
142, in <module>
from . import core
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\__init__.py",
line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from
"C:\Users\'Username'\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
Many thanks in advance for any help and suggestions.

DLL load failed for pytables

I get the following error when running code containing pytables:
Traceback (most recent call last):
File "C:\Users\pierr\python354\lib\site-packages\pandas\io\pytables.py", line 469, in __init__
import tables # noqa
File "C:\Users\pierr\python354\lib\site-packages\tables\__init__.py", line 90, in <module>
from .utilsextension import (
ImportError: DLL load failed: The specified procedure could not be found.
...
File "C:\Users\pierr\python354\lib\site-packages\pandas\io\pytables.py", line 472, in __init__
'importing'.format(ex=str(ex)))
ImportError: HDFStore requires PyTables, "DLL load failed: The specified procedure could not be found." problem importing
python version 3.5.4 |
tables version 3.4.2 | windows 10
I had a similar problem. When I tried to run the following code:
import pandas as pd
df = pd.read_hdf('some.hdf')
I got an error:
ImportError: Missing optional dependency 'tables'. Use pip or conda to install tables.
Even though the pytables module was installed using both conda and pip (with last, of course as tables), the error still persisted.
The import tables didn't work either:
from .utilsextension import (
ImportError: DLL load failed: Не найден указанный модуль.
"Не найден указанный модуль" means "The specified module was not found" in Russian.
I climbed into the folder where the last module from the Traceback is located - '~\AppData\Roaming\Python\Lib\site-packages\tables' and found file named utilsextension.cp37-win_amd64.pyd there. Then I downloaded Dependency Walker utility and looked at this file. The program said it couldn't find pytables_hdf5.dll. I found this file in the folder ~\AppData\Roaming\Python\Lib\site-packages\tables\ and added it to a PATH variable by:
os.environ['PATH'] += os.pathsep + os.path.expanduser('~\\AppData\\Roaming\\Python\\Lib\\site-packages\\tables')
After that everything worked, import tables and pd.read_hdf return no more errors.
Hope this is useful to someone.
Installing PyTables using these installation instructions helped me to resolve this issue. I used Conda option.
I had the same problem. It went away after I uninstalled and reinstalled pytables.
conda remove -n MYENVNAME pytables
conda config --add channels conda-forge
conda install pytables

Why on earth can I not import nashpy into my Python library?

import nashpy as nash
I'm attempting to import nashpy but I keep receiving the error message below despite already pip installing nashy:
File "G:\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl
ImportError: cannot import name 'NUMPY_MKL'
>>>
Could you help me understand it?
If you look at the line which is causing the error, you'll see this:
from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl
This line comment states the dependency as numpy+mkl (numpy with Intel Math Kernel Library). This means that you've installed the numpy by pip, but the scipy was installed by precompiled archive, which expects numpy+mkl.
This problem can be easy solved by installation for numpy+mkl from whl file from here.

cx_freeze and scipy: "ImportError: cannot import name vode"

i am trying to create an executable from my python script. My script runs fine, but after freezing it, starting the .exe gives me the following error:
http://www.bild.me/bild.php?file=4663406scipyerror.png
I am using Python 3.2.3, Scipy 0.12.0b1, Numpy 1.7.0 and Matplotlib 1.2.0 (all 32bit).
Any ideas/hints on how to solve this? My guess is i have to include something manually in my freezing script, but i am running out of guesses :-(
I got it finally to work, but I am very unsatisfied with my solution:
1) copy _odepack.pyd and odepack.py from the SciPy package to my program folder
2) in odepack.py change from . import _odepack to import _odepack (otherwise ValueError: Attempted relative import in non-package is raised)
3) in my main change from scipy.integrate import odeint to from odepack import odeint
Now it is working as expected and after using cx_freeze it is still working.
Still got no idea why it would not work before :-(
Thanks ThomasK for pushing me in the right direction though :-)
I finally got around this vode-problem by specifying "scipy.integrate.vode" as an include in the cx setup-file. This resulted in a file "scipy.integrate.vode.pyd" to end up in the build folder. I am using SciPy 0.11, Python 3.2.3 and the latest cx on Windows.
But adding such a "scipy.integrate.vode" file manually to the build folder would not fix the problem for me either, even though such manual-include-fixes were needed for many other .pyd files cx could not find either (and whereby the above setup.py include-solution would not work instead)...
Thanks for sharing your distress and wisdom, would not have managed to freeze my program otherwize...

Resources