I have some problems with the example of stable-baselines and look forward to your help.
The environment is set as:
Windows 10
spyder 3.6
tensorflow 1.4.0
gym 0.15.4
stable_baselines 2.8.0
However, I cannot import:
from stable_baselines.common import make_vec_env
The error is:
Traceback (most recent call last):
File "<ipython-input-96-9dcb30379014>", line 1, in <module>
from stable_baselines.common import make_vec_env
ImportError: cannot import name 'make_vec_env'
If this is the module we are talking about.
https://github.com/hill-a/stable-baselines
Seems like there was an issue that has been solved in 2.9.0:
https://github.com/araffin/rl-baselines-zoo/issues/51
Upgrade your stable-baselines:
pip install stable-baselines==2.9.0
And then it should be enough to use:
from stable_baselines.common.cmd_util import make_vec_env
Related
I have installed 'pandas_profiling' through conda install -c conda-forge pandas-profiling in the base environment. I could see through the conda list that pandas_profiling has been installed correctly (snapshot attached),
When I try to import pandas_profiling I receive ModuleNotFoundError
import pandas_profiling
Traceback (most recent call last):
File "<ipython-input-4-60d2bac64bfc>", line 1, in <module>
import pandas_profiling
ModuleNotFoundError: No module named 'pandas_profiling'
Update: output of import sys; print(sys.path); print(sys.prefix)
['/home/user1/miniconda3/lib/python38.zip', '/home/user1/miniconda3/lib/python3.8', '/home/user1/miniconda3/lib/python3.8/lib-dynload', '', '/home/user1/miniconda3/lib/python3.8/site-packages', '/home/user1/miniconda3/lib/python3.8/site-packages/IPython/extensions', '/home/user1/.ipython']
/home/user1/miniconda3
This is a frequent issue, check out this entry in the FAQ.
Occasionally you will encounter this error if you import a package from the current notebook. It is important to ensure that the pip version is associated with the current Python kernel. That way, the installed packages can be used in the current notebook.
As detailed here, the shell environment and the Python executable are disconnected.
This should work for you
import sys
!{sys.executable} -m pip install pandas-profiling
I installed tensorflow 1.13.1 and protobuf 3.6.1. successfully. But when I tried to import protobuf 3.6.1, an error occurs. I used python 3.6.0
Error is given below:
import protobuf
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'protobuf'
because of this i cannot import tensorflow
As discussed in comments, working with pip to get tensorflow running on this particular system turned out to be complicated. Instead, we went with Anaconda installation:
conda create -n yourenvname tensorflow
To import protobuf:
import google.protobuf
I installed anaconda to C:\Users\chris\Anaconda3. When I type conda list it verifies that I have BeautifulSoup4 installed.
However when I start C:\Users\chris\Anaconda3\python.exe and try to import BeautifulSoup it doesn't work:
>>> import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'BeautifulSoup'
When I'm in the Anaconda Navigator it also lists the package but when I try to start base(root)/Open with python I can't import my package. Neither can Spyder that I installed.
What do I have to do, to fix this?
i'm sorry but maybe you need to import in this way ?
from bs4 import BeautifulSoup
docs
I'm running python 2.7.13 under windows 10 and I'm struggling to get nltk properly running.
Here's what happens when I try to import nltk:
>>> import nltk
Traceback (most recent call last):
File "<pyshell#4>", line 2, in <module>
import nltk
File "C:\Python27\lib\site-packages\nltk-3.2.3-py2.7-win32.egg\nltk\__init__.py", line 128, in <module>
from nltk.chunk import *
File "C:\Python27\lib\site-packages\nltk-3.2.3-py2.7-win32.egg\nltk\chunk\__init__.py", line 157, in <module>
from nltk.chunk.api import ChunkParserI
File "C:\Python27\lib\site-packages\nltk-3.2.3-py2.7-win32.egg\nltk\chunk\api.py", line 13, in <module>
from nltk.parse import ParserI
File "C:\Python27\lib\site-packages\nltk-3.2.3-py2.7-win32.egg\nltk\parse\__init__.py", line 81, in <module>
from nltk.parse.corenlp import CoreNLPParser, CoreNLPDependencyParser
File "C:\Python27\lib\site-packages\nltk-3.2.3-py2.7-win32.egg\nltk\parse\corenlp.py", line 17, in <module>
import requests
ImportError: No module named requests
The following packages are installed:
cycler 0.10.0
functools32 3.2.3.post2
matplotlib 2.0.2
nltk 3.2.3
numpy 1.12.1
pyparsing 2.2.0
python-dateutil 2.6.0
pytz 2017.2
PyYAML 3.12
six 1.10.0
I have already tried to uninstall nltk and also uninstalled and reinstalled python and then I followed these instructions:
http://lizusefulstuff.blogspot.de/2012/03/how-to-install-nltk-package-for-python.html
However, with these instructions I get stuck with step 5. When I enter
python -m nltk.downloader
I get the message
C:\Python27\python.exe: No module named requests
Does anyone have a hint what I'm doing wrong here or what else I could try to get nltk running in my setup? I assume there is still a way to use nltk with python 2.7?
From what I found so far, it seems easier to install nltk with python 3.4 but I'd like to avoid a python upgrade, if possible, since aside from my nltk experiments I'm following along a coding tutorial that refers to python 2.7.
Thank you for any hints!
In the latest version of nltk (v3.2.3), there's an issue with "optional" dependency, see https://github.com/nltk/nltk/issues/1725
The ImportError would happen in any OS (Windows / Linux / Mac) since it's a python dependency issue.
This is due to the additional dependency that nltk.parse.corenlp needs but it isn't elegantly imported and the imports were exposed at the top level at https://github.com/nltk/nltk/blob/develop/nltk/parse/init.py#L81
To install nltk with requests to patch this problem:
pip install -U nltk[corenlp]
For fuzz-free installation, installs all packages that all nltk submodules would require:
pip install -U nltk[all]
Alternatively, you can install the request package separatedly:
pip install requests
Hopefully, issue #1725 gets resolved soon and a minor patched version of the release will be re-released soon.
Using Macports,
I've tried to install: gdal, py27gdal, and gdal-grass. All so I can import gdal into python 2.7.2.
Neither have been successful.
When I type:
port list installed
I see the installed modules:
gdal-grass #1.4.3 gis/gdal-grass
gdbm #1.8.3 databases/gdbm
py27-gdal #1.7.1 python/py27-gdal
And when I run python to import the module:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gdal
What am I doing wrong?
Are you using the MacPorts python2.7? Try launching Python this way:
/opt/local/bin/python2.7
I'm not 100% sure if this solves your problem, but gdal is in the osgeo namespace. So you should try importing gdal like this:
from osgeo import gdal
The gdal namespace itself is deprecated.