I have a machine that has Python 2.7 and Python 3.4 installed. Normally to install packages under Python 3.4, I would run pip3 install [PACKAGE].
But now when I run pip3 I get
Traceback (most recent call last):
File "/volume1/#appstore/python3/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/python3/lib/python3.4/site-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/python3/lib/python3.4/site-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/python3/lib/python3.4/site-packages/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/python3/lib/python3.4/site-packages/pip/wheel.py", line 32, in <module>
from pip import pep425tags
File "/usr/local/python3/lib/python3.4/site-packages/pip/pep425tags.py", line 335, in <module>
supported_tags = get_supported()
File "/usr/local/python3/lib/python3.4/site-packages/pip/pep425tags.py", line 307, in get_supported
elif is_manylinux1_compatible():
File "/usr/local/python3/lib/python3.4/site-packages/pip/pep425tags.py", line 163, in is_manylinux1_compatible
return have_compatible_glibc(2, 5)
File "/usr/local/python3/lib/python3.4/site-packages/pip/pep425tags.py", line 187, in have_compatible_glibc
version = [int(piece) for piece in version_str.split(".")]
File "/usr/local/python3/lib/python3.4/site-packages/pip/pep425tags.py", line 187, in <listcomp>
version = [int(piece) for piece in version_str.split(".")]
ValueError: invalid literal for int() with base 10: '20-2014'
Even if I download get-pip.py and run python3 get-pip.py, I get the same error.
What could the problem be?
Edit: Apparently this is a problem that is persistent on Synology installs when you installed DSM 6.0.
Found solution courtesy of #Tadhg in the comments above.
Here is a link to the necessary changes to pep425tags.py.
But here are the changes needed for all of you who are on this SO page.
Add the following function:
# Separated out from have_compatible_glibc for easier unit testing
def check_glibc_version(version_str, needed_major, needed_minor):
# Parse string and check against requested version.
#
# We use a regexp instead of str.split because we want to discard any
# random junk that might come after the minor version -- this might happen
# in patched/forked versions of glibc (e.g. Linaro's version of glibc
# uses version strings like "2.20-2014.11"). See gh-3588.
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
if not m:
warnings.warn("Expected glibc version with 2 components major.minor,"
" got: %s" % version_str, RuntimeWarning)
return False
return (int(m.group("major")) == needed_major and
int(m.group("minor")) >= needed_minor)
and replace
# Parse string and check against requested version.
version = [int(piece) for piece in version_str.split(".")]
if len(version) < 2:
warnings.warn("Expected glibc version with 2 components major.minor,"
" got: %s" % version_str, RuntimeWarning)
return False
return version[0] == major and version[1] >= minimum_minor
with return check_glibc_version(version_str, major, minimum_minor)
Related
Im trying to install the gym atari package on version 0.9.5 (I specifically need this version), but when I run the code (which is supposed to be running smoothly if gym is properly downloaded), I get the following error:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
The problem occurred when I tried to run gym.make().
Does anyone know how to fix this?
The same behavior happened to me with python 3.9, but for some reason not on python 3.8 (there was a different error there). Maybe Im missing some rendering library?
The full error message is:
[2021-05-22 02:17:05,405] Making new env: PongNoFrameskip-v4
C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py:17: PkgResourcesDeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
result = entry_point.load(False)
Traceback (most recent call last):
File "C:/Users/1/PycharmProjects/University Homework/Reinforcement Learning/dqn/main.py", line 61, in <module>
env = get_env(task, seed)
File "C:\Users\1\PycharmProjects\University Homework\Reinforcement Learning\dqn\utils\gym.py", line 13, in get_env
env = gym.make(env_id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 164, in make
return registry.make(id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 122, in make
env = spec.make()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 89, in make
env = cls(**self._kwargs)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 32, in __init__
self.game_path = atari_py.get_game_path(game)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\atari_py\games.py", line 20, in get_game_path
raise Exception('ROM is missing for %s, see https://github.com/openai/atari-py#roms for instructions' % (game_name,))
Exception: ROM is missing for pong, see https://github.com/openai/atari-py#roms for instructions
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\utils\closer.py", line 67, in close
closeable.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Exception ignored in: <function Env.__del__ at 0x00000203EE2174C8>
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 203, in __del__
self.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Also, the relevant code:
if __name__ == '__main__':
# Get Atari games.
benchmark = gym.benchmark_spec('Atari40M')
# Change the index to select a different game.
task = benchmark.tasks[3]
# Run training
seed = 0 # Use a seed of zero (you may want to randomize the seed!)
env = get_env(task, seed)
And get_env is:
def get_env(task, seed):
env_id = task.env_id
env = gym.make(env_id)
set_global_seeds(seed)
env.seed(seed)
expt_dir = 'tmp/gym-results'
env = wrappers.Monitor(env, expt_dir, force=True)
env = wrap_deepmind(env)
return env
The error looks like the Atari ROM for pong is not found. This is probably due to the fact that gym no longer installs ROMs automatically, due to licensing issues.
But there's an easy workaround now:
pip install -U gym
pip install -U gym[atari,accept-rom-license]
The accept-rom-license option installs a package called autorom which provides the AutoROM command, and runs it automatically with the --accept-rom-license option.
Then everything just works normally.
Details:
If you run AutoROM without the --accept-license option, this is what you get, so be warned:
AutoROM will download the Atari 2600 ROMs.
They will be installed to:
[...]/site-packages/AutoROM/roms
Existing ROMs will be overwritten.
I own a license to these Atari 2600 ROMs.
I agree to not distribute these ROMs and wish to proceed: [Y/n]:
Run AutoROM --help for more options.
Cassandra Version 2.1.1
Python Version 3.8
Using CCM to run 3 virtual Cassandra nodes on a single machine.
While running cqlsh : Getting the below stack trace.
C:\Users\manjr\.ccm\repository\2.1.1\bin>python cqlsh
cqlsh:491: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if custom_prompt is not '':
Traceback (most recent call last):
File "cqlsh", line 120, in <module>
from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling, async_insert, meter
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\cqlhandling.py", line 21, in <module>
from . import pylexotron, util
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\pylexotron.py", line 304, in <module>
class ParsingRuleSet:
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\pylexotron.py", line 305, in ParsingRuleSet
RuleSpecScanner = SaferScanner([
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\saferscanner.py", line 32, in __init__
(SUBPATTERN, (len(p)+1, self.subpat(phrase, flags))),
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\saferscanner.py", line 41, in subpat
return cls.scrub_sub(re.sre_parse.parse(phrase, flags), flags)
File "C:\Users\manjr\.ccm\repository\2.1.1\bin\..\pylib\cqlshlib\saferscanner.py", line 59, in scrub_sub
raise ValueError("RE flag setting not allowed in SaferScanner lexicon (%s)" % (bin(sub.state.flags),))
ValueError: RE flag setting not allowed in SaferScanner lexicon (0b110010)
Cassandra 2.1.1 doesn't support Python 3.x at all. You need to have Python 2 installed to make it running. Python 3 is supported only in upcoming 4.0. Support for Python 3 in Cassandra 3.x is only planned (see CASSANDRA-16403)
I had some minimal updates in the "source" folder and rebuilt the HTML using make html command. Everything works fine and I synced the folder to GitHub. However, when I was rebuilding the doc on the Read the Docs website, I got an error like this right after cat source/conf.py :
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'
I just added some texts and fixed some typos in my documentation, nothing more. Why this error occurred and the build failed? Thanks.
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
mod = __import__(extname, None, None, ['setup'])
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbsphinx.py", line 41, in <module>
import nbconvert
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/__init__.py", line 4, in <module>
from .exporters import *
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/exporters/__init__.py", line 4, in <module>
from .slides import SlidesExporter
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/exporters/slides.py", line 12, in <module>
from ..preprocessors.base import Preprocessor
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/preprocessors/__init__.py", line 7, in <module>
from .csshtmlheader import CSSHTMLHeaderPreprocessor
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/preprocessors/csshtmlheader.py", line 14, in <module>
from jupyterlab_pygments import JupyterStyle
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/jupyterlab_pygments/__init__.py", line 4, in <module>
from .style import JupyterStyle
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/jupyterlab_pygments/style.py", line 10, in <module>
class JupyterStyle(Style):
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/pygments/style.py", line 101, in __new__
ndef[0] = colorformat(styledef)
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/pygments/style.py", line 58, in colorformat
assert False, "wrong color format %r" % text
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'
Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/pygments/style.py", line 58, in colorformat
assert False, "wrong color format %r" % text
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'
The full traceback has been saved in /tmp/sphinx-err-scp_kb7h.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
I had this issue with iPython notebooks since I had an old version of Pygments. Upgrade Pygments with
pip3 install --upgrade Pygments
I was also suffering from the same.In my case that raise due to beacause i update the notebook to the lastest version and left the conda itself to a very old one so it may cause a problem but whem i ran code: pip3 install Pygments==2.6.1it worked perfectly fine for me
This seems to be related to the version of Pygments one is using (see this GitHub issue for details), which needs to be greater than 2.4.1.
In my case, the problem was solved by requiring ReadTheDocs to use: Pygments==2.6.1
I was facing the same issue. For me this got solved by following the steps in Python command fails with AssertionError: wrong color format, basically by installing nbconvert==6.0.0rc0. Thanks
I followed the doc but got the following error:
>>> from snimpy.manager import Manager as M
from snimpy.manager import load
load("IF-MIB")
m = M("localhost")
print(m.ifDescr[0])
Traceback (most recent call last):
File "<input>", line 4, in <module>
File "/home/ed8/projects/coaxis-opt/env/lib/python3.5/site-packages/snimpy/manager.py", line 578, in load
m = mib.load(mibname)
File "/home/ed8/projects/coaxis-opt/env/lib/python3.5/site-packages/snimpy/mib.py", line 605, in load
raise SMIException("unable to find {0} (check the path)".format(mib))
snimpy.mib.SMIException: unable to find b'IF-MIB' (check the path)
Question
What is IF-MIB? Do I need to install some package on my system?
Reference
Doc example fails: snimpy.mib.SMIException: unable to find b'IF-MIB' (check the path)
As provided by snimpy developer:
If you are on Ubuntu, you need to
apt-get install snmp-mibs-downloader
Using the basic example on their website:
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(my_box, update=True)
start_display()
I can't get that to run? Any ideas?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\SimpleGui.py", line 164, in init_display
win.canva.InitDriver()
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 79, in InitDriver
self._display = OCCViewer.Viewer3d(self.GetHandle())
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 55, in GetHandle
return int(self.winId())
TypeError: int() argument must be a string or a number, not 'PyCObject'
That's a duplication of a github issue:
https://github.com/tpaviot/pythonocc-core/issues/68
we need to know which GUI library your using and what verion of pythonocc you are one.
this is an older version of pythonocc, the current you can find here:
Why not try and install that newer version?
Its important that the OCE library you've got installed match.
So pythonocc-core 0.16 goes with OCE 0.16