Issue running python script via PyCharm but not Anaconda Prompt - python

When I run a script in Anaconda Prompt, it works fine.
When I try to run it via PyCharm, I get this error related to the import of pandas.
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Process finished with exit code 1
If I try to import numpy and run it via PyCharm I get:
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\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 "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import numpy as np
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\ProgramData\Anaconda3\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
Running the same script in Anaconda prompt...no problem
My run configuration in PyCharm uses the Anaconda python distribution?
It should be noted that I am not using envirnoments, just the base Anaconda installation. More worryingly I dont see ANY Conda options in the project settings in PyCharm which a lot of tutorials seem to allude to.

Seems like a problem with the path for your scripts. Are you sure You have included your scripts in the PATH variable? If so are you sure your libraries are downloading/installing in that path?

Related

numpy dependencies thrown an error when importing pandas to my python project

I have got the following traceback error when importing pandas. I have installed all packages using anaconda3 distribution and also verified everything seems alright. When I use conda search numpy on command prompt also returns the installed packages. But if I try to import pandas as pd it throws an error.(numpy: No module named 'logging.handlers'; 'logging' is not a package) Need some guidance here.
Traceback (most recent call last):
File "1.py", line 1, in <module>
import pandas as pd
File "E:\Anaconda3\envs\venv\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: No module named 'logging.handlers'; 'logging' is not a package
I have a logging.py file on my project directory. After renaming the file also returns following error
Traceback (most recent call last):
File "1.py", line 1, in <module>
import pandas as pd
File "E:\Anaconda3\envs\venv\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: attempted relative import with no known parent package
After changing the entire project to a new directory resolves the issue.

Cannot run anaconda

I just installed anaconda and I have udpated the PATH variable.
However, I cannot run any conda related commands.
Every time I run a command starting with "conda" I get the following error.
Can anyone help?
I am using macOs High Sierra 10.13.6.
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 18, in <module>
from urllib.request import url2pathname
File "/anaconda3/lib/python3.6/urllib/request.py", line 2585, in <module>
from _scproxy import _get_proxy_settings, _get_proxies
ImportError: dlopen(/anaconda3/lib/python3.6/lib-dynload/_scproxy.cpython-36m-darwin.so, 2): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /anaconda3/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/conda", line 11, in <module>
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 112, in main
from ..exceptions import conda_exception_handler
File "/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 18, in <module>
from .common.io import timeout
File "/anaconda3/lib/python3.6/site-packages/conda/common/io.py", line 24, in <module>
from .path import expand
File "/anaconda3/lib/python3.6/site-packages/conda/common/path.py", line 21, in <module>
from urllib import unquote, url2pathname # NOQA
ImportError: cannot import name 'unquote'
I seem to recall something similar when I first ran Anaconda on my Mac as well. I believe I solved it by doing two things:
Uninstalling Anaconda (Link)
Reinstalling Anaconda (potentially in a different location, say, under your User home)
I think in the process of installation my PATH pointed finally to a different location than the Conda/Python install.

Run-time error: cannot import name py31compat

Have a compiled app that fails when multiarray attempts to import py31compat. It runs fine from source.
I am using Anaconda2-4.4.0-Windowsx86_64.exe (windows 7)
Using numpy-1.12.1, which was installed with pip
Compiling with py2exe script.
The error it gives is:
Traceback (most recent call last):
File "AutoFastener.py", line 23, in <module>
File "BatchControl\modBatchController.pyo", line 94, in <module>
File "FastenerDataSetUtilities\modFDDUtils.pyo", line 21, in <module>
File "scipy\__init__.pyo", line 61, in <module>
File "numpy\__init__.pyo", line 180, in <module>
File "numpy\add_newdocs.pyo", line 13, in <module>
File "numpy\lib\__init__.pyo", line 8, in <module>
File "numpy\lib\type_check.pyo", line 11, in <module>
File "numpy\core\__init__.pyo", line 23, in <module>
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.
cannot import name py31compat
I've tried upgrading setuptools and distribute with pip, which did not help.
I've looked in the executables LIB file, and the pkg_resources has py31compat.pyo in it, which as far as I've been able to determine is where it should be.
I don't know how to figure out where the multiarray.pyd is trying to load it from.

Python ImportError "cannot import name 'multiarray'

I'm trying to simply import numpy into a python script (called "MatPlotLib.py using PyCharm) and I'm receiving this odd error. It worked fine, but then I started messing around with Jupyter. I tried uninstalling and reinstalling Python, then a system restore, but nothing seems to be working. I think reinstalling numpy will do the trick, though I'm not sure how to do that.
I'm not sure what the error means by "a numpy git repo, so any help would be greatly appreciated. If you need any additional information please let me know. Find the full error below! :)
Thank you so much in advanced.
C:\ProgramData\Anaconda3\python.exe
C:/Users/Alex/PycharmProjects/2017_Research/Automation/MatPlotLib.py
Traceback (most recent call last): File
"C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\core__init__.py",
line 16, in
from . import multiarray ImportError: cannot import name 'multiarray'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:/Users/Alex/PycharmProjects/2017_Research/Automation/MatPlotLib.py",
line 1, in
import numpy File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy__init__.py",
line 142, in
from . import add_newdocs File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\add_newdocs.py",
line 13, in
from numpy.lib import add_newdoc File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\lib__init__.py",
line 8, in
from .type_check import * File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\lib\type_check.py",
line 11, in
import numpy.core.numeric as _nx File "C:\Users\Alex\AppData\Roaming\Python\Python36\site-packages\numpy\core__init__.py",
line 26, in
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'
Process finished with exit code 1

numpy in Python 3.6: Importing the multiarray numpy extension module failed

Can anyone help me with this error? I don't have any older versions of numpy, and i installed it using pip, i get 1.13.0 version of numpy and I'm working on Windows 10 OS. Any suggestions?
Traceback (most recent call last):
File "C:/Users/Asus/PycharmProjects/g/num.py", line 1, in <module>
import numpy
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Asus\AppData\Local\Programs\Python\Python36-32\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 procedure could not be found.
You are, apparently, a victim of issue 9272. numpy is built against Python 3.6.1 but you're using Python 3.6.0.
Based on the discussion there, you should just upgrade to Python 3.6.1 to get it to work. It does seem like they will build on 3.6.0 too, though, follow that issue to keep track of that.

Categories

Resources