DLL load failure upon attempt to import sklearn modules - dll

I'm trying to import a scikit-learn module
from sklearn.model_selection import train_test_split
and receive the error message
File "C:\Software\Anaconda\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'm not the first person to encounter this issue
(Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found)
but neither of the remedies suggested in that discussion
uninstall/reinstall scipy
modify the fixes.py file
solved my problem. Any new ideas would be appreciated.

Related

hello i am new to python. i installed matplotlib in my Visual studio but whenever i try to run the file it displays the error

I wanted to plot a graph. but suddenly i could not because of the import error. yet i have installed matplotlib and numpy.
Traceback (most recent call last):
File "c:\Users\user\Documents\plot.py", line 1, in
from matplotlib import pyplot as plt
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib_init_.py", line 109, in
from . import _api, _version, cbook, docstring, rcsetup
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\rcsetup.py", line 27, in
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\colors.py", line 56, in
from matplotlib import _api, cbook, scale
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\scale.py", line 23, in
from matplotlib.ticker import (
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\ticker.py", line 136, in
from matplotlib import transforms as mtransforms
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\transforms.py", line 46, in
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
PS C:\Users\user\Documents>
I figured it out.
If you have already installed matplotlib, but the error still comes about. Then you have to download Microsoft C++ from their website.
https://www.microsoft.com/en-US/Download/confirmation.aspx?id=48145
install Microsoft c++ then you can try again to run your code.
it has worked for me like magic.
I got the solution from a youtube video.
link here.
https://www.youtube.com/watch?v=DpwsvUkNAmg

Run Python, Anaconda, Pandas, Numpy offline on a Server getting dependency error

After installing Anaconda on a Virtual Machine I run a script which is working on my local machine but not on my Virtual Machine.
I'm getting the error Message:
C:\Users\...\python>"C:\ProgramData\Anaconda3\python.exe" "C:\Users\...\reporting.py"
C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py:140: 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
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\...\reporting.py", line 1, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
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.8 from "C:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.18.5"
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.
The VM has no Internet. Is there any way to install all the required libs and frameworks?
You can package your script and used libraries using something like Pyinstaller. When you use an virtualenv keep in mind that all the packages that you use during pyinstaller execution are stored and may lead to an huge .exe

ImportError: cannot import name 'mesh'

I am trying to create and save an stl file with a cube and I cannot import the mesh module for some reason. When hovering over mesh, it says: "Cannot find 'mesh' in '__init__.py'" I originally had the directory folder named stlExperiments but then someone said you cannot have stl in the name so I changed all instances of "stl" to "st" and no change, so I'm left to assume it's a completely different problem. Can anybody help? I am in the dark. The import code goes as follows:
from __future__ import absolute_import, division, print_function
import numpy as np
from stl import mesh
and the error message goes as follows:
Traceback (most recent call last):
File "C:/Users/Riley/PycharmProjects/stExperiments/stCube.py", line 4, in
from stl import mesh
ImportError: cannot import name 'mesh'
Process finished with exit code 1
I had the same problem when installing stl with pip install stl
Try using pip install numpy-stl
It works on my computer (Windows 10)
NOTE:
if you are on python 3.x, simply change pip to pip3

Tensorflow object detection gives No module named 'deployment'

I'm trying to train a custom object detection module using object detection api. I have put everything together and tried to train the module using 'Google Colab'. When I try to train the module it gives this error.
Traceback (most recent call last):
File "train.py", line 49, in <module>
from object_detection import trainer
File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/trainer.py", line 33, in <module>
from deployment import model_deploy
ModuleNotFoundError: No module named 'deployment'
I also execute the blow code segment which is equivalent to export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
import sys
sys.path.append('/content/models/research/slim/')
How do I overcome this error?
Copy 'deployment' folder in 'slim'. Then paste it to 'site-packages' folder of your python environment
Hope this helps!
For Google Colab,
import os
os.environ['PYTHONPATH'] += ':/models/research/:/models/research/slim/'
this one works..

Julia PyPlot segments

This question is related to the already asked question:
Julia error using PyPlot - signal (11): Segmentation fault
However, it is not entirely clear to me what the solution there was, or whether even the steps there apply also to my case (I tried them with no effect).
I have been using Julia 4.6 for some time without any problems.
I then decided to update my Ubuntu distribution from 14 to 16.04.
This is when PyPlot stopped working.
I have updated the Julia Packages, and I also did Pkg.build("PyPlot") to no effect. I also run Pkg.test("PyCall") and it passes all tests succesfuly. I also tried the suggestion
ENV["PYTHON"] = ""; Pkg.build("PyPlot")
The situation right now is the following.
I can import PyPLot normally:
using PyPlot
This gives me no errors.
However, as soon as I invoke any command relating to PyPlot, like:
figure()
I receive the error:
signal (11): Segmentation fault
unknown function (ip: 0x32736)
Segmentation fault (core dumped)
and Julia exits of course.
I don't know if this is relevant, but out of curioustiy I tried the following thing. After starting python in the command line, I do:
import matplotlib.pyplot
which gives me the following error message:
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/usr/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 62, in <module>
import matplotlib.textpath as textpath
File "/usr/lib/python2.7/dist-packages/matplotlib/textpath.py", line 15, in <module>
import matplotlib.font_manager as font_manager
File "/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py", line 58, in <module>
from matplotlib import ft2font
ImportError: numpy.core.multiarray failed to import
All help appreciated.
EDIT:
I fixed the problem in python with the import statement by simply uninstalling and reinstalling matplotlib via pip. However, this changed nothing for Julia.
In the end I managed to solve the problem with the help of a colleague.
I first re-installed matplotlib via pip.
I had to point Julia to the system installed Python:
ENV["PYTHON"]="/usr/bin/python"
I then rebuilt PyCall and PyPlot:
Pkg.build("PyCall")
Pkg.build("PyPlot")
Restarted Julia and it worked!