Facing error messages when importing sklearn in python i.d - python

I get an error when importing sklearn in python 3.9.
I am using I.D.L.E. in Windows.
Installed it using cmd command: pip install -U scikit-learn as given in https://scikit-learn.org/stable/install.html
The received error message is:
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
import sklearn
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\__init__.py", line 82, in <module>
from .base import clone
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py", line 17, in <module>
from .utils import _IS_32BIT
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\__init__.py", line 29, in <module>
from .fixes import parse_version, threadpool_info
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\fixes.py", line 19, in <module>
import scipy.stats
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\stats\__init__.py", line 453, in <module>
from ._stats_py import *
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\stats\_stats_py.py", line 38, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\spatial\__init__.py", line 104, in <module>
from ._qhull import *
ImportError: DLL load failed while importing _qhull: The specified module could not be found.
Please help.

Since the required file _qhull.yp39-win_amd64.pyd is there, it must be a problem with the dependencies this DLL file has and can't find on your computer.
Use a dependency walker like this one to find out what is missing on your system and see that you get those missing pieces installed.
Quite likely you are missing some of the Microsoft Redistributable Visual Studio Files.

Apparently my scipy got corrupted somehow. Uninstalling and re-installing it fixed the problem. Thanks everyone who took their time and effort to help though.

Related

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

DLL load failed while importing cv2 Not enough memory resources are available to process this command

My Input
python model_main_tf2.py --model_dir=models\my_ssd_mobilenet_v2_fpnlite --pipeline_config_path=models\my_ssd_mobilenet_v2_fpnlite\pipeline.config
Output
Traceback (most recent call last):
File "model_main_tf2.py", line 32, in <module>
from object_detection import model_lib_v2
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 29, in <module>
from object_detection import eval_util
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\eval_util.py", line 36, in <module>
from object_detection.metrics import lvis_evaluation
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\object_detection\metrics\lvis_evaluation.py", line 23, in <module>
from lvis import results as lvis_results
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\lvis\__init__.py", line 5, in <module>
from lvis.vis import LVISVis
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\lvis\vis.py", line 1, in <module>
import cv2
File "D:\Users\Ozgur\anaconda3\envs\tensorflow\lib\site-packages\cv2\__init__.py", line 5, in <module>
from .cv2 import *
ImportError: DLL load failed while importing cv2: Not enough memory resources are available to process this command.
I try pip install opencv-python and other And I research but ı not found this error There is 20 gb of free space on the computer My reference https://github.com/armaanpriyadarshan/Training-a-Custom-TensorFlow-2.x-Object-Detector Please Help me.
I was having the same issue while training a model using tensorflow object detection API for custom dataset.
I struggled a lot in starting but in end i did
conda update -c conda-forge --all
I don't know why but it worked for me.

ImportError: cannot import name 'tqdm' from 'conda._vendor.tqdm' (unknown location)

Hello I am using mac actually when I searched analytics in finder I removed some folders (I thought they are useless :) after that when I type conda update or such I am getting those errors and further more.
I am keeping exact error:
Traceback (most recent call last):
File "/Users/nunemunthalashiva/anaconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 151, in main
from ..exceptions import conda_exception_handler
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 25, in <module>
from .common.io import dashlist, timeout
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 33, in <module>
from .._vendor.tqdm import tqdm
ImportError: cannot import name 'tqdm' from 'conda._vendor.tqdm' (unknown location)
Python comes with some libraries that are required to preform some basic operation later in python such as update or install libraries. I think you removed those python libraries that are required to update/used in other ....to remove these error you have to add/restore those libraries or reinstall python.

ImportError: DLL load failed: The specified procedure could not be found. (thinkdsp and thinkplot)

I am an amateur programmer. I am trying to use:
import thinkdsp as dsp
import thinkplot as plt
I have installed the pip install thinkx module but I keep getting that error and I don't understand why. I will leave what the console shows down below:
Traceback (most recent call last):
File "Karaokemaker1.py", line 1, in <module>
import thinkdsp as dsp
File "C:\Users\keigo\anaconda3\lib\site-packages\thinkdsp.py", line 17, in <module>
import scipy.stats
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\stats.py", line 185, in <module>
from . import distributions
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\distributions.py", line 10, in <module>
from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py", line 25, in <module>
from scipy import optimize
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\__init__.py", line 390, in <module>
from ._minimize import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_minimize.py", line 30, in <module>
from ._trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py", line 4, in <module>
from .minimize_trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py", line 4, in <module>
from scipy.sparse.linalg import LinearOperator
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
from .eigen import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
I assumed the issue was with the scipy because all the following errors come from that module. I checked and I have everything installed properly for the scipy module.
Please help! Thank you!
Run any command prompt you are using as administrator and then run pip install lib_name --force-reinstall
Try using these two commands they will help you:
conda remove --force scipy
And:
pip install scipy
Hello I had the same issue than you. Depend on wich version of python you use you should choose a version thinkx. I recommend you to go on the website of thinkx and check out for past udapte. In my case that was with matplotlib 3.3.1 for python 3.7. I went in git bash and used
pip install matplotlib==3.0.1
and everything worked. I had the same issue with seaborn and it worked.

ImportError: No module named _io

When I compile my python scripts I'm getting the following error message. This started happening when I installed Anaconda. I've tried to find a solution online to the problem but I've had no luck. Can anyone help with solving this?
Traceback (most recent call last):
File "query.py", line 1, in <module>
import mysql.connector
File "/usr/local/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 37, in <module>
from .connection import MySQLConnection
File "/usr/local/lib/python2.7/dist-packages/mysql/connector/connection.py", line 27, in <module>
from io import IOBase
File "/usr/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: No module named _io
Are you using virtualenv? When I ran into this issue it was because of some server update which messed with the python version being used by my virtualenv. I solved the problem by deleting the virtualenv and making a new identical one.

Categories