It took me two days to install the requirements of deepQ(python version),then I tried to run it today but I faced this problem, and the code are as followed.
root#unicorn:/media/trump/Data1/wei/college/laboratory/deep_q_rl-master/deep_q_rl# python run_nips.py
A.L.E: Arcade Learning Environment (version 0.5.0)
[Powered by Stella]
Use -help for help screen.
Warning: couldn't load settings file: ./ale.cfg
Game console created:
ROM file: ../roms/breakout.bin
Cart Name: Breakout - Breakaway IV (1978) (Atari)
Cart MD5: f34f08e5eb96e500e851a80be3277a56
Display Format: AUTO-DETECT ==> NTSC
ROM Size: 2048
Bankswitch Type: AUTO-DETECT ==> 2K
Running ROM file...
Random seed is 65
Traceback (most recent call last):
File "run_nips.py", line 60, in <module>
launcher.launch(sys.argv[1:], Defaults, __doc__)
File "/media/trump/Data1/wei/college/laboratory/deep_q_rl-master/deep_q_rl/launcher.py", line 223, in launch
rng)
File "/media/trump/Data1/wei/college/laboratory/deep_q_rl-master/deep_q_rl/q_network.py", line 53, in __init__
num_actions, num_frames, batch_size)
File "/media/trump/Data1/wei/college/laboratory/deep_q_rl-master/deep_q_rl/q_network.py", line 168, in build_network
batch_size)
File "/media/trump/Data1/wei/college/laboratory/deep_q_rl-master/deep_q_rl/q_network.py", line 407, in build_nips_network_dnn
from lasagne.layers import dnn
File "/usr/local/lib/python2.7/dist-packages/Lasagne-0.2.dev1-py2.7.egg/lasagne/layers/dnn.py", line 13, in <module>
raise ImportError("dnn not available") # pragma: no cover
ImportError: dnn not available
I have already tested theano ,numpy, scipy and there was no errors coming out. But when I ran it, it said dnn not available. So I came to find dnn, and the code is like this
import theano
from theano.sandbox.cuda import dnn
from .. import init
from .. import nonlinearities
from .base import Layer
from .conv import conv_output_length
from .pool import pool_output_length
from ..utils import as_tuple
if not theano.config.device.startswith("gpu") or not dnn.dnn_available():
raise ImportError("dnn not available") # pragma: no cover
Just hope someone can help me.
Did you install CUDA and cuDNN?
Lasagne is build on top of Theano and is, in some cases, relying on cuda code (e.g. here), rather than abstracting it away.
This can be seen from the import:
from theano.sandbox.cuda import dnn
Also see: https://github.com/Lasagne/Lasagne/issues/242
To get cuDNN you need to register at NVidia as a developer, see:
https://developer.nvidia.com/accelerated-computing
Hope this helps.
Cheers,
Michael
Related
I am unable to train a self-supervised(ssl) model to create image embeddings using the lightly cli: Lightly Platform Link. I intend to select diverse example from my dataset to create an object detection model further downstream and the image embeddings created with the ssl model will help me to perform Active Learning.I have reproduced the error in the Notebook with public access -----> lightly_app_troubleshooting_stackoverflow.ipynb Link.
In the notebook shared above this cmd raises an exception:
!source /content/venv_1/bin/activate;lightly-magic \
input_dir="/content/Sunflowers" trainer.max_epochs=20 \
token='< your lightly token(free account) >' \
new_dataset_name="sunflowers_dataset" loader.batch_size=64
The exception stack trace produced is as below:
/content/venv_1/lib/python3.7/site-packages/hydra/_internal/hydra.py:127: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/next/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
configure_logging=with_log_configuration,
########## Starting to train an embedding model.
/content/venv_1/lib/python3.7/site-packages/pytorch_lightning/core/lightning.py:23: LightningDeprecationWarning: pytorch_lightning.core.lightning.LightningModule has been deprecated in v1.7 and will be removed in v1.9. Use the equivalent class from the pytorch_lightning.core.module.LightningModule class instead.
"pytorch_lightning.core.lightning.LightningModule has been deprecated in v1.7"
Error executing job with overrides: ['input_dir=/content/Sunflowers', 'trainer.max_epochs=20', 'token=5bbcf60e3a5c7c266dcd4e0e9056c8301684e0f2f8922bc5', 'new_dataset_name=sunflowers_dataset', 'loader.batch_size=64']
Traceback (most recent call last):
File "/content/venv_1/lib/python3.7/site-packages/lightly/cli/lightly_cli.py", line 115, in lightly_cli
return _lightly_cli(cfg)
File "/content/venv_1/lib/python3.7/site-packages/lightly/cli/lightly_cli.py", line 52, in _lightly_cli
checkpoint = _train_cli(cfg, is_cli_call)
File "/content/venv_1/lib/python3.7/site-packages/lightly/cli/train_cli.py", line 137, in _train_cli
encoder.train_embedding(**cfg['trainer'], strategy=distributed_strategy)
File "/content/venv_1/lib/python3.7/site-packages/lightly/embedding/_base.py", line 88, in train_embedding
trainer = pl.Trainer(**kwargs, callbacks=[self.checkpoint_callback])
File "/content/venv_1/lib/python3.7/site-packages/pytorch_lightning/utilities/argparse.py", line 345, in insert_env_defaults
return fn(self, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'weights_summary'
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
I could not create a new tag - "lightly" as I lack the stackoverflow reputation points to do so.
The error is from an incompatibility with the latest PyTorch Lightning version (version 1.7 at the time of this writing). A quick fix is to use a lower version (e.g. 1.6). We are working on a fix :)
Let me know in case that does not work for you!
I am trying to use Tensorflow Object Detection API and I follow the steps mentioned in the given link -
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html#tf-models-install
When I try to access the Object Detection Jupyter Notebook through jupyter notebook
I am facing the below exception
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/home/dinesh/.local/lib/python3.6/site-
packages/notebook/notebookapp.py", line 79, in <module>
from .base.handlers import Template404, RedirectWithParams
File "/home/dinesh/.local/lib/python3.6/site-
packages/notebook/base/handlers.py", line 32, in <module>
import prometheus_client
File "/home/dinesh/.local/lib/python3.6/site-
packages/prometheus_client/__init__.py", line 7, in <module>
from . import process_collector
File "/home/dinesh/.local/lib/python3.6/site-
packages/prometheus_client/process_collector.py", line 12, in <module>
_PAGESIZE = resource.getpagesize()
AttributeError: module 'resource' has no attribute 'getpagesize'
I am using
Python - 3.6.3
Jupyter - 1.0.0
How can I overcome this exception?
Got a similar error. My project contained modules (folders)
model
resource (replaced with resources)
service
So I changed the name of the resource module to resources (change name to any appropriate module name)
I have the same error ,after rename my resource module in the PYTHONPATH , it works right. check your PYTHONPATH, is there a resource module?
I had a similar issue on starting Jupyter Notebooks on Windows 10.
When I initially ran the regular startup script, I got a windows terminal that opened and immediately closed, too fast to see any error messages. So, I opened a windows 10 powershell terminal and ran
conda update conda
and
conda update --all
then I ran
jupyter-notebook at the windows prompt. The results were:
Traceback (most recent call last):
File "E:\Users\Bob\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "E:\Users\Bob\anaconda3\lib\site-packages\notebook\notebookapp.py", line 76, in
from .base.handlers import Template404, RedirectWithParams
File "E:\Users\Bob\anaconda3\lib\site-packages\notebook\base\handlers.py", line 24, in
import prometheus_client
File "E:\Users\Bob\anaconda3\lib\site-packages\prometheus_client_init_.py", line 3, in
from . import (
File "E:\Users\Bob\anaconda3\lib\site-packages\prometheus_client\process_collector.py", line 11, in
_PAGESIZE = resource.getpagesize()
AttributeError: module 'resource' has no attribute 'getpagesize'
I opened process_collector.py in the site-packages\prometheus_client in notepad++ and changed
line 9 import resource to import resources
and
line 11 _PAGESIZE = resource.getpagesize() to _PAGESIZE = resources.getpagesize()
I searched for other instances of resource and found none. I then saved the file and reran jupyter-notebook at the windows terminal prompt.
This time I got:
Traceback (most recent call last):
File "E:\Users\Bob\anaconda3\Scripts\jupyter-notebook-script.py", line 10, in
sys.exit(main())
File "E:\Users\Bob\anaconda3\lib\site-packages\jupyter_core\application.py", line 254, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "E:\Users\Bob\anaconda3\lib\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "E:\Users\Bob\anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "E:\Users\Bob\anaconda3\lib\site-packages\notebook\notebookapp.py", line 2126, in initialize
self.init_resources()
File "E:\Users\Bob\anaconda3\lib\site-packages\notebook\notebookapp.py", line 1697, in init_resources
old_soft, old_hard = resource.getrlimit(resource.RLIMIT_NOFILE)
AttributeError: module 'resource' has no attribute 'getrlimit'
Still having Notepad++ open, I opened notebookapp.py in site-packages\notebook and searched for resource. I found and changed the following lines:
Line 37 import resource to import resources
line 40 resource = None to resources = None
line 1036 resource is None to resources is None
line 1040 soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE) to
soft, hard = resources.getrlimit(resources.RLIMIT_NOFILE)
line 1693 if resource is None: to if resources is None:
line 1697 old_soft, old_hard = resource.getrlimit(resource.RLIMIT_NOFILE) to old_soft, old_hard = resources.getrlimit(resources.RLIMIT_NOFILE)
line 1706 resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard)) to
resources.setrlimit(resources.RLIMIT_NOFILE, (soft, hard))
I searched for other instances of resource and found none. I then saved the notebookapp.py file and reran jupyter-notebook at the windows terminal prompt. This time Jupyter Notebooks opened with the expected files tab displayed. I quit out of Jupyter Notebooks and restarted using the normal link to the startup script and it worked as expected.
I am not sure what caused this issue. I did not intentionally update anything before I saw the issue. Yesterday, Jupyter Notebooks worked as expected, today when I tried to run it, I got the flicker screen as described above.
[Quick look for root cause]
Check if you have set PYTHONPATH in your system -
try to rename that momentarily
run "jupyter notebook"
[Fix the issue]
if the issue is resolved by doing this then
search "resource" folder within all paths mentioned in PYTHONPATH
if such folder found then rename/refactor it to other name e.g. "resources"
I'm trying to import and use requests in Python 3. When I import requests I get this error in IDLE (as well as IntelliJ):
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import requests
File "/usr/local/lib/python3.6/site-packages/requests/__init__.py", line 49, in <module>
major, minor, patch = urllib3.__version__.split('.')[:3]
ValueError: not enough values to unpack (expected 3, got 2)
I've read and understand that there is an issue with requests when trying to read the version of urllib3 which needs three values to unpack (major, minor, patch). However, my version of urllib3 is 1.22 with no patch appended at the end. Here is my pip freeze:
appnope==0.1.0
beautifulsoup4==4.6.0
bleach==2.0.0
certifi==2017.7.27.1
chardet==3.0.4
chromedriver==2.24.1
cycler==0.10.0
Cython==0.26.1
decorator==4.1.2
entrypoints==0.2.3
facebook-sdk==2.0.0
geopy==1.11.0
glob2==0.6
html5lib==0.999999999
idna==2.6
ipykernel==4.6.1
ipython==6.1.0
ipython-genutils==0.2.0
ipywidgets==7.0.0
jedi==0.10.2
Jinja2==2.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.1.0
jupyter-console==5.2.0
jupyter-core==4.3.0
MarkupSafe==1.0
matplotlib==2.0.2
mistune==0.7.4
nbconvert==5.3.1
nbformat==4.4.0
nltk==3.2.4
nose==1.3.7
notebook==5.0.0
numpy==1.13.1
olefile==0.44
opencv-python==3.3.0.10
pandas==0.20.3
pandocfilters==1.4.2
pexpect==4.2.1
pickleshare==0.7.4
Pillow==4.2.1
prompt-toolkit==1.0.15
ptyprocess==0.5.2
Pygments==2.2.0
PyMySQL==0.7.11
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2017.2
pyzmq==16.0.2
qtconsole==4.3.1
requests==2.18.4
requests2==2.16.0
scikit-learn==0.19.0
scipy==0.19.1
selenium==3.6.0
simplegeneric==0.8.1
six==1.10.0
sklearn==0.0
terminado==0.6
testpath==0.3.1
tornado==4.5.2
traitlets==4.3.2
tzlocal==1.4
urllib3==1.22
virtualenv==15.1.0
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.0.2
xlrd==1.1.0
EDIT: I've found a temporary workaround solution and posted as an answer to my question. But any other answers for better solutions are welcome / encouraged. Thanks.
In order to get requests to work, I was able to find a workaround at the top of my project / IDLE session which is as follows:
import urllib3 # Must append a third value to avoid error
if len(urllib3.__version__.split('.')) < 3:
urllib3.__version__ = urllib3.__version__ + '.0'
After visiting this link I was able to confirm there is no patch to urllib3 version 1.22 at the time of this writing. I assume when a patch is released this workaround will not be necessary, but this may help somebody with a similar issue.
After upgrading my Fedora 24 to 25, I am having issue with running a python script which was running just fine under Fedora 24. No matter what I choose from that default list for backend in matplotlibrc file, I am not able to produce plots. In particular, when I choose Qt5Agg in that list for the backend, I am receiving this weird error message and it is really bothering that I cannot find any thing related to that on internet just by searching. But I am also aware that something in the upgrade could have gone wrong affecting my python and/or Qt packages. I just need to know why connectivity has to do with the choice of backend (if any at all) and why none of the default choices can get rid of any sort of error message? But to be specific, why choosing Qt5Agg as the default backend of matplotlibrc file is giving such an error message related to the function connect()? Please let me know if posting the script would help you with the answer. Here is the imports in the beginning of that script:
import numpy as np
from numpy import nan
import pandas as pd
import matplotlib as mpl
#import matplotlib
#matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import pylab as pl
from uncertainties import ufloat
from uncertainties.umath import *
from matplotlib.ticker import MaxNLocator
from collections import OrderedDict
import astropy.units as u
from astropy.cosmology import FlatLambdaCDM, z_at_value
from numpy import sqrt, mean, square, std, maximum, minimum
from sklearn.metrics import mean_squared_error
from scipy.stats import poisson, chi2
import math
import sys
And the error message:
QObject::connect: Cannot connect NavigationToolbar2QT::message(QString) to (null)::_show_message()
Traceback (most recent call last):
File "myscript.py", line 496, in <module>
f, ((ax1, ax6, ax11), (ax2, ax7, ax12), (ax3, ax8, ax13), (ax4, ax9, ax14), (ax5, ax10, ax15)) = plt.subplots(5, 3, sharex=True, sharey=False , figsize=(20,9))
File "/usr/lib/python3.5/site-packages/matplotlib/pyplot.py", line 1177, in subplots
fig = figure(**fig_kw)
File "/usr/lib/python3.5/site-packages/matplotlib/pyplot.py", line 527, in figure
**kwargs)
File "/usr/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 43, in new_figure_manager
return new_figure_manager_given_figure(num, thisFig)
File "/usr/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 51, in new_figure_manager_given_figure
return FigureManagerQT(canvas, num)
File "/usr/lib/python3.5/site-packages/matplotlib/backends/backend_qt5.py", line 465, in __init__
self.toolbar.message.connect(self._show_message)
TypeError: connect() failed between NavigationToolbar2QT.message[str] and _show_message()
It's a bug in that backend, exposed by more strict checking in PyQt 5.7.
It was fixed in July - I suggest you open a Fedora bug so they upgrade those packages or backport the fix.
As for why this happens: This is not related to connectivity as in network, but connecting of Qt's signals and slots.
Recently, Dill has completely stopped working for me. It does this:
>>> import dill
>>> dill.dumps([1,2,3])
b'\x80\x03]q\x00(K\x01K\x02K\x03e.'
>>> dill.loads(_)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\dill\dill.py", line 260, in loads
return load(file)
File "C:\Python34\lib\site-packages\dill\dill.py", line 250, in load
obj = pik.load()
File "C:\Python34\lib\pickle.py", line 1039, in load
dispatch[key[0]](self)
File "C:\Python34\lib\pickle.py", line 1066, in load_proto
raise ValueError("unsupported pickle protocol: %d" % proto)
ValueError: unsupported pickle protocol: 93
The number is different every time. This started happening maybe a month ago; reinstalling Dill with pip didn't help.
From stepping through it with a debugger it looks like it's correctly reading in the protocol version from the beginning of the data, then reading one of the first instructions in the pickle data and interpreting it as the protocol version for some reason. I don't really know though, since I don't know much about how pickle works.