PyXNAT Error while importing in python3.4 - python

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.

Related

import ldap3 error File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/dist-packages/ldap3/__init__.py", line 255, in <module>

I have installed ldap3 module for my python3. When I try to run import ldap3, I get such error. Can someone please advice me what to do?
python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ldap3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/ldap3/__init__.py", line 255, in <module>
from .core.connection import Connection
File "/usr/local/lib/python3.9/dist-packages/ldap3/core/connection.py", line 53
from ..strategy.async import AsyncStrategy
^
SyntaxError: invalid syntax
>>>

Can not import Marionette

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

Managed to break my venv; is it possible to fix?

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.

How to install RunSnakeRun on OS X with MacPorts?

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

ImportError with pythons libghmm library

I have followed the installation directions to install the GHMM library. However, I still get the following error:
Python 2.6.6 (Apr 11 2011, 15:50:32)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ghmm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ghmm.py", line 112, in <module>
import ghmmwrapper
File "ghmmwrapper.py", line 25, in <module>
_ghmmwrapper = swig_import_helper()
File "ghmmwrapper.py", line 17, in swig_import_helper
import _ghmmwrapper
ImportError: libghmm.so.1: cannot open shared object file: No such file or directory
I tried to change my LD_PRELOAD_PATH variable to /usr/local/lib to no avail.
Also, when I try to locate libghmm, I get the following, so the libraries are definitely there:
% locate libghmm
/usr/local/lib/libghmm.a
/usr/local/lib/libghmm.la
/usr/local/lib/libghmm.so
/usr/local/lib/libghmm.so.1
/usr/local/lib/libghmm.so.1.0.0
Any ideas?

Categories

Resources