Closed Erdnaf closed 3 years ago
Ok, this issue really seems to be a bug in Python 3.9: https://discuss.python.org/t/differences-between-3-8-and-3-9-in-importing-module/5520. It was solved on 2021-03-20, so if you install again the newest Python 3.9 version or a lower version (e.g. 3.8) it should work.
Can confirm that it works now. Updated from 3.9.4 to 3.9.5 and see no import issues anymore. Works without virtualenv too.
Does not work on python 3.9.5 for me
Python 3.9.5 (default, May 19 2021, 11:32:47)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
->>> import privacy_evaluator
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jakob/Downloads/privML/env/lib/python3.9/site-packages/privacy_evaluator/__init__.py", line 4, in <module>
from privacy_evaluator import attacks
ImportError: cannot import name 'attacks' from partially initialized module 'privacy_evaluator' (most likely due to a circular import) (/home/jakob/Downloads/privML/env/lib/python3.9/site-packages/privacy_evaluator/__init__.py)```
Hey @adrinjalali do you know what we're might be doing wrong here?
Strangely enough the notebook doesn't work for me now. I did a fresh install:
$ pip uninstall privacy_evaluator
$ git clone git@github.com:privML/privacy-evaluator.git
$ cd privacy-evaluator
$ pip install .
$ python3
>>> from privacy_evaluator.models.torch import dcti
>>> model = dcti.load_dcti()
>>> model
Should show the summary of the model. It might be possible, however, that some imports don't work but you can try the above and see if it works.
Just did the above now and it works. Python version summary:
Python 3.9.5 (default, May 4 2021, 03:33:11)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
import privacy_evaluator
doesn't work for me if I run python3 outside of privacy-evaluator
directory, so we definitely have a problem here.
Have you tried relative imports and setting the __all__
attribute in your __init__
files, including the one in attack
module? It seems your imports are causing a circular import path.
I think we solved this issue so I close it.
I cant run the Notebook in the notebook folder.
With the help of @marisanest I installed a vitual environment based on python 3.9 and installed the Package with requirements.
But when I try to import the privacy_evaluator from the notebook i get this error:
How can i fix this?
I try to get it running maybe its because of python 3.9. but that schuldn't be the problem