import arcpy in the VS Code terminal fails - python

I am trying to get arcpy to import in the vs code terminal (running python 2.7 as an arcgis install). It runs fine if I open a command window, initiate python, and import arcpy. It also works within the ArcGIS environment. This leads me to beloeve that the error below is inaccurate. Importing arcpy does not work at the VS Code terminal. How can I resolve this?
>>> import arcpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\__init__.py", line 20, in <module>
import numpy
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python27\ArcGIS10.6\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\ArcGIS10.6\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 specified path is invalid.

Related

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.

from scipy.linalg import _fblas: ImportError: DLL load failed: The specified module could not be found

I did some changes on my Anaconda installation (I just uninstalled previous one, and installed a newer version). Now trying to run my code simply importing this:
from skimage.measure import compare_ssim
But it shows this error. How can I fix it? All searching didn't help. When I do this import on Anaconda Prompt, it doesn't complaint. But when I run this on Eclipse, it shows this error.
Traceback (most recent call last):
File "C:\Users\user\eclipse-workspace\project\hybrid.py", line 18, in <module>
from skimage.measure import compare_ssim
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\__init__.py", line 176, in <module>
from .util.lookfor import lookfor
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\util\__init__.py", line 12, in <module>
from ._montage import montage, montage2d
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\util\_montage.py", line 2, in <module>
from .. import exposure
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\exposure\__init__.py", line 1, in <module>
from .exposure import histogram, equalize_hist, \
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\exposure\exposure.py", line 4, in <module>
from ..color import rgb2gray
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\color\__init__.py", line 1, in <module>
from .colorconv import (convert_colorspace,
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\color\colorconv.py", line 59, in <module>
from scipy import linalg
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\__init__.py", line 190, in <module>
from .misc import *
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\blas.py", line 214, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
Uninstalling and re-installing Numpy+mkl from here fixed, in my case.
My error arised from from scipy import signal. But it had given the same error as yours:
"from scipy.linalg import _fblas: ImportError: DLL load failed: The specified module could not be found"
I realized when I run this import on Anaconda Prompt, it doesn't complaint. But when I run this on Eclipse, it shows this error.
The simple solution was to add this to my PATH that helped fix the problem:
C:\Users\user\AppData\Local\Continuum\anaconda3\Library\bin

Pycharm can't find the python(conda env) packages

I'm using a conda env as python interpreter and I've all the necessary packages installed
But when I run the file, I get this error
Traceback (most recent call last):
File "D:\Anaconda3\envs\tf\lib\site-packages\numpy\core\__init__.py", line 16,
in <module>
from . import multiarray
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 "D:/Programming Projects/python projects/MaskRCNN/src/test_tf.py", line 8
, in <module>
import numpy as np
File "D:\Anaconda3\envs\tf\lib\site-packages\numpy\__init__.py", line 142, in
<module>
from . import add_newdocs
File "D:\Anaconda3\envs\tf\lib\site-packages\numpy\add_newdocs.py", line 13, i
n <module>
from numpy.lib import add_newdoc
File "D:\Anaconda3\envs\tf\lib\site-packages\numpy\lib\__init__.py", line 8, i
n <module>
from .type_check import *
File "D:\Anaconda3\envs\tf\lib\site-packages\numpy\lib\type_check.py", line 11
, in <module>
import numpy.core.numeric as _nx
File "D:\Anaconda3\envs\tf\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 specified module could not be found.
Process finished with exit code 1
But when I run it from the terminal, it works just fine
Does anyone have any clue on what might be a fix?
It is a known issue, should be fixed in 2019.1 EAP. Could you please update and check?

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

numpy error when running Python script from cmd

I have a Python script which I want to start from cmd because I'm going to call it in a C# script.
The problem is, the code works fine in the IDE and when I call it from the Anaconda script but not when I call it from the regular cmd.
I'm calling the script with the following line:
$ python c:/Users/myname/pycharmProjects/testing/main.py
I get the following error message:
Traceback (most recent call last):
File "c:/Users/myname/pycharmProjects/testing/main.py", line 1, in <module>
import process
File "/cygdrive/c/Users/myname/pycharmProjects/testing/process.py", line 4, in <module>
import numpy as np
File "/cygdrive/c/Users/myname/pycharmProjects/testing/numpy/__init__.py", lin e 142, in <module>
from . import add_newdocs
File "/cygdrive/c/Users/myname/pycharmProjects/testing/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/cygdrive/c/Users/myname/pycharmProjects/testing/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/cygdrive/c/Users/myname/pycharmProjects/testing/numpy/lib/type_check.py ", line 11, in <module>
import numpy.core.numeric as _nx
File "/cygdrive/c/Users/myname/pycharmProjects/testing/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: cannot import name multiarray
I have uninstalled and reinstalled numpy, but the error is still the same. I'm really confused why I it works via the Anaconda prompt, but not the cmd as I did set the PATH variable.
Any help is appreciated!

Categories