Posts: 65
Threads: 18
Joined: Dec 2018
Dec-17-2018, 10:49 PM
(This post was last modified: Dec-17-2018, 10:49 PM by gehrenfeld.)
I am using anaconda3 and python 3.7
Here is my code:
import numpy as np
import pandas as pd
data = pd.read_csv("summary.csv")
data.head() Here is the error I get:
Quote:C:\Users\gary\Anaconda3\envs\py37\python.exe C:/Users/gary/pyfiles/condacurd/gl.py
Traceback (most recent call last):
File "C:\Users\gary\Anaconda3\envs\py37\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/gary/pyfiles/condacurd/gl.py", line 1, in <module>
import numpy
File "C:\Users\gary\Anaconda3\envs\py37\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\gary\Anaconda3\envs\py37\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\gary\Anaconda3\envs\py37\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\gary\Anaconda3\envs\py37\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\gary\Anaconda3\envs\py37\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
I have searched the web for this problem and there are many solutions. I have tried must of them with no results.
I have reinstall Anaconda3, Pandas, Numpy. Ran git clean -xdf.
Has anyone really solved this?
Gary
Posts: 7,320
Threads: 123
Joined: Sep 2016
Do you know that you try to run from virtual environment?
envs\ is where Anaconda place virtual environment.
..Anaconda3\python.exe is the main python.exe that is linked to over 1000 module/packages installed.
C:\Users
λ cd..
C:\
λ cd Anaconda3\
C:\Anaconda3
λ python -V
Python 3.6.5 :: Anaconda, Inc.
C:\Anaconda3
λ ls python.exe
python.exe* So if i want run your code it will be from root Anaconda3.
Then of course numpy,pandas..ect is installed.
C:\Anaconda3
λ python movie.py
Seven 1995
0 The Godfather 1972
1 Jaws 1975 Virtual environment as you try to run has no module/packages installed bye default.
Take a look at Anaconda and other ways to run Python.
Posts: 65
Threads: 18
Joined: Dec 2018
Dec-17-2018, 11:47 PM
(This post was last modified: Dec-18-2018, 12:36 AM by gehrenfeld.)
I will try iy from the base env. But I cloned the base to py37 so it should work.
I update my py37 env with numpy and panmdas.
Now I get
Quote:Traceback (most recent call last):
File "C:\Users\gary\Anaconda3\envs\py37\lib\site-packages\IPython\core\interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-a552d78b0a5b>", line 1, in <module>
runfile('C:/Users/gary/pyfiles/condacurd', wdir='C:/Users/gary/pyfiles/condacurd')
File "C:\Program Files\JetBrains\PyCharm 2018.3\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2018.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "C:\Users\gary\Anaconda3\envs\py37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:/Users/gary/pyfiles/condacurd'
when I run the code. This is a nightmare
Gary
Posts: 7,320
Threads: 123
Joined: Sep 2016
Dec-18-2018, 01:02 AM
(This post was last modified: Dec-18-2018, 01:08 AM by snippsat.)
(Dec-17-2018, 11:47 PM)gehrenfeld Wrote: PermissionError: [Errno 13] Permission denied: 'C:/Users/gary/pyfiles/condacurd' Run PyCharm as Administrator.
Why are you messing with virtual environment?
Do have it running without,also Anaconda as default interpreter Configuring Python Interpreter PyChram.
Do all work okay from Navigator,like Juyter Notebook?
If i should make a virtual environment,with pandas,numy,..ect it will be this command.
conda create -n my_env scipy pandas numpy requests
So using conda which is Anaconda3 package manager,it's in Scripts folder.
If want to look at the full run and Activate of my_env :
G:\Anaconda3\Scripts
λ conda create -n my_env scipy pandas numpy requests
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.4
latest version: 4.5.12
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: G:\Anaconda3\envs\my_env
added / updated specs:
- numpy
- pandas
- requests
- scipy
The following packages will be downloaded:
package | build
---------------------------|-----------------
openssl-1.1.1a | he774522_0 5.7 MB
cryptography-2.4.2 | py37h7a1dbc1_0 550 KB
wheel-0.32.3 | py37_0 53 KB
numpy-1.15.4 | py37h19fb1c0_0 47 KB
mkl_fft-1.0.6 | py37h6288b17_0 168 KB
scipy-1.1.0 | py37h29ff71c_2 13.3 MB
python-3.7.1 | h8c8aaf0_6 17.7 MB
requests-2.21.0 | py37_0 85 KB
pytz-2018.7 | py37_0 257 KB
numpy-base-1.15.4 | py37hc3f5095_0 3.9 MB
sqlite-3.26.0 | he774522_0 936 KB
six-1.12.0 | py37_0 22 KB
mkl_random-1.0.2 | py37h343c172_0 328 KB
idna-2.8 | py37_0 101 KB
urllib3-1.24.1 | py37_0 150 KB
mkl-2019.1 | 144 158.3 MB
setuptools-40.6.3 | py37_0 631 KB
icc_rt-2019.0.0 | h0cc432a_1 9.4 MB
python-dateutil-2.7.5 | py37_0 276 KB
intel-openmp-2019.1 | 144 1.7 MB
pandas-0.23.4 | py37h830ac7b_0 8.6 MB
certifi-2018.11.29 | py37_0 146 KB
pip-18.1 | py37_0 1.8 MB
------------------------------------------------------------
Total: 224.2 MB
The following NEW packages will be INSTALLED:
asn1crypto: 0.24.0-py37_0
blas: 1.0-mkl
ca-certificates: 2018.03.07-0
certifi: 2018.11.29-py37_0
cffi: 1.11.5-py37h74b6da3_1
chardet: 3.0.4-py37_1
cryptography: 2.4.2-py37h7a1dbc1_0
icc_rt: 2019.0.0-h0cc432a_1
idna: 2.8-py37_0
intel-openmp: 2019.1-144
mkl: 2019.1-144
mkl_fft: 1.0.6-py37h6288b17_0
mkl_random: 1.0.2-py37h343c172_0
numpy: 1.15.4-py37h19fb1c0_0
numpy-base: 1.15.4-py37hc3f5095_0
openssl: 1.1.1a-he774522_0
pandas: 0.23.4-py37h830ac7b_0
pip: 18.1-py37_0
pycparser: 2.19-py37_0
pyopenssl: 18.0.0-py37_0
pysocks: 1.6.8-py37_0
python: 3.7.1-h8c8aaf0_6
python-dateutil: 2.7.5-py37_0
pytz: 2018.7-py37_0
requests: 2.21.0-py37_0
scipy: 1.1.0-py37h29ff71c_2
setuptools: 40.6.3-py37_0
six: 1.12.0-py37_0
sqlite: 3.26.0-he774522_0
urllib3: 1.24.1-py37_0
vc: 14.1-h0510ff6_4
vs2015_runtime: 14.15.26706-h3a45250_0
wheel: 0.32.3-py37_0
win_inet_pton: 1.0.1-py37_1
wincertstore: 0.2-py37_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
openssl-1.1.1a | 5.7 MB | ################################################################################################################ | 100%
cryptography-2.4.2 | 550 KB | ################################################################################################################ | 100%
wheel-0.32.3 | 53 KB | ################################################################################################################ | 100%
numpy-1.15.4 | 47 KB | ################################################################################################################ | 100%
mkl_fft-1.0.6 | 168 KB | ################################################################################################################ | 100%
scipy-1.1.0 | 13.3 MB | ################################################################################################################ | 100%
python-3.7.1 | 17.7 MB | ################################################################################################################ | 100%
requests-2.21.0 | 85 KB | ################################################################################################################ | 100%
pytz-2018.7 | 257 KB | ################################################################################################################ | 100%
numpy-base-1.15.4 | 3.9 MB | ################################################################################################################ | 100%
sqlite-3.26.0 | 936 KB | ################################################################################################################ | 100%
six-1.12.0 | 22 KB | ################################################################################################################ | 100%
mkl_random-1.0.2 | 328 KB | ################################################################################################################ | 100%
idna-2.8 | 101 KB | ################################################################################################################ | 100%
urllib3-1.24.1 | 150 KB | ################################################################################################################ | 100%
mkl-2019.1 | 158.3 MB | ############################################################################################################### | 100%
setuptools-40.6.3 | 631 KB | ################################################################################################################ | 100%
icc_rt-2019.0.0 | 9.4 MB | ################################################################################################################ | 100%
python-dateutil-2.7. | 276 KB | ################################################################################################################ | 100%
intel-openmp-2019.1 | 1.7 MB | ################################################################################################################ | 100%
pandas-0.23.4 | 8.6 MB | ################################################################################################################ | 100%
certifi-2018.11.29 | 146 KB | ################################################################################################################ | 100%
pip-18.1 | 1.8 MB | ################################################################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > activate my_env
#
# To deactivate an active environment, use:
# > deactivate
G:\Anaconda3\Scripts
λ activate my_env
(my_env) G:\Anaconda3\Scripts
λ cd ..
(my_env) G:\Anaconda3
λ cd envs\my_env\
(my_env) G:\Anaconda3\envs\my_env
λ pip -V
pip 18.1 from G:\Anaconda3\envs\my_env\lib\site-packages\pip (python 3.7)
(my_env) G:\Anaconda3\envs\my_env
λ which python
/g/Anaconda3/envs/my_env/python
Posts: 65
Threads: 18
Joined: Dec 2018
Dec-18-2018, 01:12 AM
(This post was last modified: Dec-18-2018, 01:12 AM by gehrenfeld.)
So why does it work in Jupyter.
Anaconda says not to run projects in the base.
I ran PyCharm as administrator and use the Anaconda\python.exe interpreter, same permission issue
Gary
Posts: 7,320
Threads: 123
Joined: Sep 2016
Dec-18-2018, 02:18 AM
(This post was last modified: Dec-18-2018, 02:18 AM by snippsat.)
Try do it simple place the script an other place eg root Anaconda3 folder.
Run cmd as Administrator .
I can show a run in cmd,i normally always use cmder.
# movie.py
import numpy as np
import pandas as pd
data = pd.read_csv("movies.csv")
print(data.head()) G:\>cd Anaconda3
# Test Python version
G:\Anaconda3>python -V
Python 3.6.5 :: Anaconda custom (64-bit)
# Run script,now is shown version over used
G:\Anaconda3>python movies.py
Seven 1995
0 The Godfather 1972
1 Jaws 1975
G:\Anaconda3> When work command line,then try in PyCharm,make sure that root python.exe in Anaconda3 folder is chosen Configuring Python Interpreter PyChram.
I don't use PyChram,but VS Code.
When you use Jupyter Notebook from Navigator or shortcut,it always use main python.exe in Anaconda3 then it should work.
Or if you use Anaconda prompt(Anaconda own cmd shortcut).
Posts: 65
Threads: 18
Joined: Dec 2018
Dec-18-2018, 01:24 PM
(This post was last modified: Dec-18-2018, 01:55 PM by gehrenfeld.)
I ran it in the Anaconda3 directory.
Quote:C:\Users\gary\Anaconda3>python Untitled.py
Traceback (most recent call last):
File "C:\Users\gary\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 "Untitled.py", line 1, in <module>
import numpy as np
File "C:\Users\gary\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\gary\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\gary\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\gary\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\gary\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.
It has something to do with numpy. I ran the code without numpy and it works okay.
I have uninstalled and reinstall numpy. I have uninstalled Anaconde3. Neither one helped.
I found out the problem.
I ran task manager and found I had 6 pythons running at the same time. Not sure how that happened but when I killed all the python task and then ran the code it worked.
Thank you for all your help and I apologize for not catching that earlier.
Gary
Gary
Posts: 24
Threads: 11
Joined: Nov 2018
i have this type of problem early in the start. Installing on your system and on an interpreter are different things
|