I've installed the wxWidgets-3.0 py27-wxpython-3.0 MacPorts packages. In a clean virtualenv I installed the wx, SquareMap, and RunSnakeRun pip packages. Attempting to run runsnake fails as follows:
Traceback (most recent call last):
File "/Users/lhn/.virtualenvs/snake/bin/runsnake32", line 9, in <module>
load_entry_point('RunSnakeRun==2.0.4', 'gui_scripts', 'runsnake32')()
File "/Users/lhn/.virtualenvs/snake/lib/python2.7/site-packages/pkg_resources.py", line 353, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/lhn/.virtualenvs/snake/lib/python2.7/site-packages/pkg_resources.py", line 2321, in load_entry_point
return ep.load()
File "/Users/lhn/.virtualenvs/snake/lib/python2.7/site-packages/pkg_resources.py", line 2048, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Users/lhn/.virtualenvs/snake/lib/python2.7/site-packages/runsnakerun/runsnake.py", line 14, in <module>
from squaremap import squaremap
File "/Users/lhn/.virtualenvs/snake/lib/python2.7/site-packages/squaremap/squaremap.py", line 3, in <module>
import wx.lib.newevent
ImportError: No module named lib.newevent
In IDLE I see teh same import error:
Python 2.7.6 (default, Nov 18 2013, 15:12:51)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> import wx.lib.newevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named lib.newevent
Related
When I try to import Marionette driver in Python, I get this response:
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from marionette import Marionette
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/marionette_client-2.0.0-py2.7.egg/marionette/__init__.py", line 7, in <module>
from .marionette_test import (
File "/usr/local/lib/python2.7/dist-packages/marionette_client-2.0.0-py2.7.egg/marionette/marionette_test.py", line 18, in <module>
from marionette_driver.errors import (
File "/usr/local/lib/python2.7/dist-packages/marionette_driver-1.1.1-py2.7.egg/marionette_driver/__init__.py", line 7, in <module>
from marionette_driver import (
File "/usr/local/lib/python2.7/dist-packages/marionette_driver-1.1.1-py2.7.egg/marionette_driver/expected.py", line 8, in <module>
from marionette import HTMLElement
File "/usr/local/lib/python2.7/dist-packages/marionette_driver-1.1.1-py2.7.egg/marionette_driver/marionette.py", line 20, in <module>
from mozrunner import B2GEmulatorRunner
ImportError: cannot import name B2GEmulatorRunner
>>>
I have the Mozrunner package installed, but it does not have any B2GEmulatorRunner. Any suggestion as to what is causing this issue and how I can resolve this?
Edit:
After updating my entire Python 2.7 library with PIP, now I am stuck with this issue:
>>> import marionette
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/marionette/__init__.py", line 7, in <module>
from .marionette_test import (
ImportError: No module named marionette_test
This is an odd problem. I have Python script which imports numpy and matplotlib.
If I put those scripts into /usr/local/bin, I can load the modules and run my scripts with no problem.
But if I have those scripts in my "work" directory, I get errors.
This is also true if I use python in interactive mode:
$ pwd
/usr/local/bin
$ python
Python 2.7.12 (default, Oct 10 2016, 12:56:26)
[GCC 5.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import matplotlib
>>>
No problems.
However, if I go to my work directory, I have problems:
$ pwd
/home/Administrator/Documents/Projects/MOCC/rads
$ python
Python 2.7.12 (default, Oct 10 2016, 12:56:26)
[GCC 5.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 170, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/site-packages/numpy/core/__init__.py", line 46, in <module>
from numpy.testing import Tester
File "/usr/lib/python2.7/site-packages/numpy/testing/__init__.py", line 13, in <module>
from .utils import *
File "/usr/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in <module>
from tempfile import mkdtemp
File "/usr/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/cygdrive/c/Users/Administrator/Documents/Projects/MOCC/rads/io.py", line 63, in <module>
SEEK_CUR = 1
File "/cygdrive/c/Users/Administrator/Documents/Projects/MOCC/rads/io.py", line 58, in main
AttributeError: 'module' object has no attribute 'loadtxt'
This is cygwin on MS Windows.
I have installed TensorFlow and wanted to check the installation. Here is the interaction with the python console.
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 106, in <module>
from tensorflow.python.platform import test
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/platform/test.py", line 81, in <module>
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/mock.py", line 81, in <module>
inspectsignature = funcsigs.signature
AttributeError: 'module' object has no attribute 'signature'
>>>
Could anyone please tell what I am doing wrong? Thanks.
As Yaroslav noted, this is most likely from running too old a version of Python, or you don't have the funcsigs package installed. For the latter, try pip install funcsigs
I have installed a package pyxnat on python3.4. i have installed required dependencies like httplib2 package and lxml correctly. but still when i import pyxnat i get following error.
bash-3.2$ python3.4
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyxnat import Interface
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/__init__.py", line 13, in <module>
from .core import Interface
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/__init__.py", line 4, in <module>
from .interfaces import Interface
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 19, in <module>
from .select import Select
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/select.py", line 4, in <module>
from .search import Search
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/search.py", line 15, in <module>
from .errors import is_xnat_error, catch_error
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/errors.py", line 31
except Exception, e:
^
SyntaxError: invalid syntax
Any suggestions to correct this?
Thanks!
EDIT:
In python 2.7 i get the following error
>>> myXNAT = Interface('https://hd-hni-xnat.cac.berkley.edu:8443/xnat')
User: sdb356
Password:
(<type 'exceptions.IOError'>, 'interfaces.py', '')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 228, in __init__
self._get_entry_point()
File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 271, in _get_entry_point
raise e
IOError: [Errno 13] Permission denied
I tried looking into interfaces.py to understand the error but wasnt..
You have installed pyxnat for python2 and are trying to import it in the python3 interpreter, you have also somehow managed to add your python 2 path to your python 3 path.
I managed to break one of my virtual environments. I think I did it by installing pycrypto with pip and uninstalling it with easy_install.
This is what I get when I run python in the venv.
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$ python
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in <module>
import os
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 49, in <module>
import posixpath as path
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 17, in <module>
import warnings
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.py", line 8, in <module>
import types
File "types.py", line 1, in <module>
import json
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 3, in <module>
import re
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 280, in <module>
import copy_reg
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.py", line 7, in <module>
from types import ClassType as _ClassType
ImportError: cannot import name ClassType
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$
And outside the venv everything works as expected:
Last login: Tue Apr 7 22:30:08 on ttys005
filip#dratmac:~$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How can I fix this?
You should not name your file types.py as there is a standard library module with the same name (import types).
As such, Python tries to import it as part of some standard library code but it now actually imports your local types.py file, not the module it expects.
So the problem should be fixed when you rename types.py to something else.