Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas and numpy
#1
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
Reply
#2
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.
Reply
#3
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
Reply
#4
(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:
Reply
#5
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
Reply
#6
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).
Reply
#7
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
Reply
#8
i have this type of problem early in the start. Installing on your system and on an interpreter are different things
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 617 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Pandas dataframes and numpy arrays bytecrunch 1 1,339 Oct-11-2022, 08:08 PM
Last Post: Larz60+
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,633 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  How to compare two json and write to third json differences with pandas and numpy onenessboy 0 4,724 Jul-24-2020, 01:56 PM
Last Post: onenessboy
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 2,515 Apr-04-2020, 10:57 PM
Last Post: Ibaraki
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 3,000 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  Convert indexing For Loop from MATLAB (uses numpy and pandas) bentaz 3 4,206 Mar-20-2018, 08:29 PM
Last Post: bentaz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020