error in import z3 - python

I am trying to use z3 in pydev, I add the path of z3py and libz3.dll to window/preferences/pydev/jython-interpreter, but i got the error as the following
Traceback (most recent call last):
File "C:\Users\linda\workspace\LearningPyDev\main.py", line 11, in
import z3
File "C:\Users\linda\z3\python\z3.py", line 45, in
from z3printer import *
File "C:\Users\linda\z3\python\z3printer.py", line 8, in
import sys, io, z3
ImportError: No module named io
What is the io module anyway? Is it possible to run z3 in pydev?

io is a core Python module. It was added in 2.6 and has been present in every subsequent version. Are you on a very old version of Python? If you're running Python version 2.5 or earlier (you can check with python --version in any commandline), you'll need to update Python to a newer version.

Related

Error Import awswrangler: AttributeError: module 'multiprocessing' has no attribute 'connection'

I have a python script that uses the lib awswrangler. Today my scrpit started to give errors in the import of the library and I don't know what is happening.
I'm running the script in a docker container with image python: 3.8
Example:
import awswrangler as wr
print(wr.__version__)
Error:
Traceback (most recent call last):
File "src/avec/automation/TaskBaseUserPass.py", line 1, in <module>
from awswrangler.pandas import Pandas
File "/usr/local/lib/python3.8/site-packages/awswrangler/__init__.py", line 17, in <module>
from awswrangler.pandas import Pandas # noqa
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 45, in <module>
class Pandas:
File "/usr/local/lib/python3.8/site-packages/awswrangler/pandas.py", line 273, in Pandas
def _read_csv_once_remote(send_pipe: mp.connection.Connection, session_primitives: "SessionPrimitives",
AttributeError: module 'multiprocessing' has no attribute 'connection'
I have been experienced the same issue today when trying to import awswrangler. For me, downgrading the following dependencies helped:
pip install fsspec==0.6.3 PyAthena==1.10.2 s3fs==0.4.0
It seems that one or more of them were causing the problem.
If your code uses multiprocessing.connection.Listener or multiprocessing.connection.Client, then you should use:
import multiprocessing.connection
If you just use
import multiprocessing
.. then your code might get an ImportError or not. It depends on other modules. If an other module imports multiprocessing.connection, then it will work.
But I guess you don't want random behavior, and that's why you should import multiprocessing.connection.
I managed to run version 3.6, the library has a problem with mp.connection.Connection in current python versions

Module method showing strange behavior

Guys I'm facing a problem on using this module which i install from pip currently my OS is Windows python36 64bit version is install. When i'm using and try to import this module
from drawtree import draw_level_order
draw_level_order('{3,9,20,#,#,15,7}')
Why python giving strange errors like this
Traceback (most recent call last):
File "C:/Users/Root/PycharmProjects/untitled/src/Test.py", line 1, in <module>
from drawtree import draw_level_order
File "C:\Python36-64\lib\site-packages\drawtree\__init__.py", line 7, in <module>
from drawtree import draw_bst, draw_random_bst, draw_level_order
ImportError: cannot import name 'draw_bst'
The version of drawtree on PyPI is not currently compatible with Python 3. There's a Python 3-compatible version on Github, if you really want to use drawtree on Python 3.

Python igraph import error on Windows

I've installed igraph form .whl file using pip install. When I was trying to test the correctness of installation
import igraph.test
igraph.test.test()
I got this error:
Traceback (most recent call last):
File "D:/Nauka/Praca-inzynierska/Barabasi-Albert.py", line 4, in <module>
import igraph.test
File "D:\Programy\Python 3.5\lib\site-packages\igraph\__init__.py", line 34, in <module>
from igraph._igraph import *
ImportError: No module named 'igraph._igraph'
(the same error pops out if I'm trying to import igraph not igraph.test).
I've tried adding path (I don't know if this is rigth):
import sys
sys.path.append ("D:/Programy/Python 3.5/Lib/site-packages/igraph")
but it didn't work.
One thing I discovered is that if I delete "__init__" file from igraph folder I can import igraph without error, but it doesn't work for igraph.test.
If it's relevant I have Python 2.7 installed on my machine alongside Python 3.5.
Thank you in advance for any help.

How to import a Python module into Jython?

I can use the module correctly by Python, but when using Jython, some error occurs...
Code:
from jieba import *
Errors:
Traceback (most recent call last):
File "/Users/Jack/Documents/workspace/FirstJython/hellojyphon.py", line 8, in <module>
from jieba import *
File "/Users/Jack/Documents/workspace/FirstJython/jieba/__init__.py", line 15, in <module>
from ._compat import *
ImportError: No module named _compat
Is there any differences between Python and Jython when import?
I solve it by myself.
There is something wrong when using relative directories in Jython.
so after I change ._compat to jieba._compat, the problem solved!
But I don't exactly know the reason...

ImportError: couldn't find library

I am encountering these errors frequently when I install python libraries and I'm wondering what I am doing wrong
the current example is the libchromaprint library
http://acoustid.org/chromaprint
I install it and everything, try to run the python example, get:
Traceback (most recent call last):
File "examples/fpwav.py", line 7, in <module>
import chromaprint
File "build/bdist.linux-x86_64/egg/chromaprint/__init__.py", line 24, in <module>
ImportError: couldn't find libchromaprint
and then when I check:
find /usr/local/lib/libch*
/usr/local/lib/libchromaprint.so
/usr/local/lib/libchromaprint.so.0
/usr/local/lib/libchromaprint.so.0.1.3
what am I doing wrong?
Python does not use your usual library path. The chromaprint you're looking for should be somewhere like /usr/lib/pymodules/python2.6.
From the python interpreter do:
>>> import sys
>>> sys.path
This will show you the directories python searches for a module.

Categories

Resources