SORMAS-Foundation / SORMAS-data-generator

SORMAS-data-generator
GNU General Public License v3.0
3 stars 7 forks source link

[importer] cannot import name 'Disease' from 'sormas' #12

Closed robbmue closed 3 years ago

robbmue commented 3 years ago

I'm trying to generate some data for my local SORMAS install. But when following the README steps, im running into the following error:

Traceback (most recent call last):
  File "/home/robbmue/projects/SORMAS-data-generator/importer/main.py", line 3, in <module>
    from universe.world import World
  File "/home/robbmue/projects/SORMAS-data-generator/importer/universe/world.py", line 7, in <module>
    from sormas import Disease, SymptomState, CaseOutcome, PresentCondition
ImportError: cannot import name 'Disease' from 'sormas' (/home/robbmue/projects/SORMAS-data-generator/importer/venv/lib/python3.9/site-packages/sormas-1.0.0-py3.9.egg/sormas/__init__.py)

My System has the following configuration:

ArchLinux 
5.9.12-arch1-1
Python 3.9.0
Docker version 19.03.14, build 5eb3275d40

What am i doing wrong?

JonasCir commented 3 years ago

Hi thanks for raising the issue @robbmue I just ran into the same error today while I was working on #11 I use debian:buster-slim as base image and I encounter exactly the same error. Interestingly, I use ArchLinux as well, but it works for me locally, but not inside Docker

JonasCir commented 3 years ago

My best guess right now is that there is some problem with python3 setup.py install and that it behaves differently on different platforms (b/c as I mentioned before it works on my host)

JonasCir commented 3 years ago

I got something. Inside the Docker container

source ./venv/bin/activate
python3
>>> import sormas
>>> dir(sormas)
>>>
['ApiAttributeError', 'ApiClient', 'ApiException', 'ApiKeyError', 'ApiTypeError', 'ApiValueError', 'Configuration', 'OpenApiException', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'api_client', 'configuration', 'exceptions', 'model_utils', 'rest']

Inside the interpreter from sormas import ApiClient will therefore work but importing Disease will not. On my local system dir(sormas) will list all reexports correctly.


This is even stranger as the build happens inside a fresh venv

JonasCir commented 3 years ago

@robbmue Can you please share the output of docker run openapitools/openapi-generator-cli version with me?

robbmue commented 3 years ago

The Output is 5.0.0-SNAPSHOT

robbmue commented 3 years ago

Hi thanks for raising the issue @robbmue I just ran into the same error today while I was working on #11 I use debian:buster-slim as base image and I encounter exactly the same error. Interestingly, I use ArchLinux as well, but it works for me locally, but not inside Docker

Maybe you could share your Dockerfile so that we're working on the same basis?

JonasCir commented 3 years ago

I got it to work with openapitools/openapi-generator-cli:v4.3.1 so it is a regression I'm going to report upstream tomorrow. I'll open a draft PR such that you get access to my work

robbmue commented 3 years ago

Is fixed in #14