I'm using Windows 10, and installed Python 3.7.3 using Anaconda3.
I need the following package for using Dakota:
numpy
scipy
pandas
I tested that the python environment is set up properly by executing import numpy, import scipy, and import pandas in command prompt window. I also added the path to environment variable.
However, the python package in Dakota does not work correctly. When I start Python with the python command and then execute the import dakota command, the dakota package is not imported and the following error shows:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dakota'
Related
I can't seem to run this code in python 3.7.7
import panda as pd
all_data = pd.read_csv('gas_prices.csv')
print(all_data)
Traceback (most recent call last):
File "c:/Users/HP/Desktop/VSc Code/Understanding pand/Sales_analysis/sale_data.py", line 1, in <module>
import panda as pd
File "C:\Users\HP\AppData\Local\Programs\Python\Python37\lib\site-packages\panda\__init__.py", line 1, in <module>
from request import PandaRequest
ModuleNotFoundError: No module named 'request'
I try to change the interpreter but it doesn't seem to make a difference and I don't think I'm in a virtual environment.
This was working a few days ago but suddenly this error started appearing.
accourding to pypi use : pip install request
You've manually installed part of pandas and accidentally named it "panda". Instead use the tool pip, which in Python 3.7.7 is included. Like so:
C:\> C:\Users\HP\AppData\Local\Programs\Python\Python37\Scripts\pip.exe install pandas
Good luck!
I haven't used RPy2 for a number of years (and then I only played around a bit). However, I now want to start using Python and R a bit more seriously and decided to re-explore the RPy2 library.
I'm using a Mac running El Capitan. I created a new virtual environment (called env34) using Python 3.4.4 and installed the latest version of pip (19.1.1) using get-pip.py. I then pip installed numpy, pandas and jupyter into the activated environment. I also pip installed RPy2 (but had to include a trusted-host flag):
(env34) $ pip install rpy2 --trusted-host=https://pypi.org/simple/cffi
I also installed the latest version of R (3.6.0) in the default location in Applications folder and edited .bash_profile to create a RHOME environment variable by adding the following:
RHOME="/Library/Frameworks/R.framework/Resources"
export RHOME
Now when I launch Python in the virtual environment, I can import rpy2 with no problems. However, I'm trying to follow the tutorial given at http://heather.cs.ucdavis.edu/~matloff/rpy2.html and when I try to import rpy2.robjects using:
>>> from rpy2.robjects import r
I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path_to_virtual_environment/env34/lib/python3.4/site-packages/rpy2/robjects/__init__.py", line 14, in <module>
import rpy2.rinterface as rinterface
File "/path_to_virtual_environment/env34/lib/python3.4/site-packages/rpy2/rinterface.py", line 5, in <module>
import rpy2.rinterface_lib._rinterface_capi as _rinterface
File "/path_to_virtual_environment/env34/lib/python3.4/site-packages/rpy2/rinterface_lib/_rinterface_capi.py", line 8, in <module>
from . import conversion
File "/path_to_virtual_environment/env34/lib/python3.4/site-packages/rpy2/rinterface_lib/conversion.py", line 8, in <module>
from . import _rinterface_capi as _rinterface
ImportError: cannot import name '_rinterface_capi'
As far as I can see, all the files referenced in the message exist in the correct locations.
Can anyone interpret this error message and perhaps offer a workaround?
Thanks in advance.
I need help with the pyodbc Python module. I installed it via Canopy package management, but when I try to import it, I get an error (no module named pyodbc). Why?
Here's the output from my Python interpreter:
import pyodbc
Traceback (most recent call last):
File "", line 1, in
import pyodbc
ImportError: No module named 'pyodbc
For the record: the attempted import was in a different Python installation. It is never good, and usually impossible, to use a package which was installed into one Python installation, in another Python installation.
I have installed python-opencv and I can run import cv2 and check version without problems from a python shell.
When trying to source this python file in gdb to provide a new gdb command I always get:
(gdb) source /opt/src/matrix-viewer/misc/matrix-viewer-gdb.py
Traceback (most recent call last):
File "/opt/src/matrix-viewer/misc/matrix-viewer-gdb.py", line 17, in <module>
import cv2.cv as cv
ImportError: No module named 'cv2'
My PC has got the sole python instance from Ubuntu distribution, why from gdb I'm getting an import problem regarding this just installed package that I'm able to load from a python shell.
EDIT
This is a python 2 package, and gdb loads python 3... Seems unsolvable.
When I try to import the slycot module in spyder (version 2.2), I get the following error:
RuntimeError: module compiled against API version 7 but this version of numpy is 6
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/__init__.py",
line 4, in <module>
from slycot.analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/analysis.py",
line 21, in <module>
from slycot import _wrapper
ImportError: numpy.core.multiarray failed to import
Now, when I import slycot in the python shell through my terminal, there are no problems at all. I think the reason why there are no problems through the terminal, is that I recently installed numpy 1.7.1. Spyder on the other hand still uses numpy 1.6.2.,hence the error.
I tried to change the numpy version in spyder, but so far that didn't work.
When I change the numpy(6) folder in my spyder lib with the recently installed numpy(7), I get the following error (in spyder):
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
What is the best way to solve this error?
Thanks in advance.
(Spyder dev here) At the moment it's not possible for the user to install anything inside the app. I guess you moved your slycot module from another interpreter to our App (because of the numpy error you mention).
The right way to use different modules not present in the app, is to change the path of your interpreter in:
Tools > Preferences > Console > Advanced settings > Python executable
If you installed slycot using your system Python, you have to select
/usr/bin/python