Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ImportError when using rtoml in python:alpine container #65

Open
Bogay opened this issue Aug 28, 2023 · 0 comments
Open

ImportError when using rtoml in python:alpine container #65

Bogay opened this issue Aug 28, 2023 · 0 comments

Comments

@Bogay
Copy link

Bogay commented Aug 28, 2023

I encountered an error message while working within my python:alpine container:

Traceback (most recent call last):
  File "//example.py", line 2, in <module>
    import rtoml
  File "/usr/local/lib/python3.11/site-packages/rtoml/__init__.py", line 5, in <module>
    from . import _rtoml
ImportError: cannot import name '_rtoml' from partially initialized module 'rtoml' (most likely due to a circular import) (/usr/local/lib/python3.11/site-packages/rtoml/__init__.py)

It seems that this error is caused by using wrong wheel, if I compile rtoml from source then the error gone. To reproduce, you can run the following command sequence:

Create container:

docker run --rm -it python:alpine sh

Inside the container:

wget https://raw.githubusercontent.com/samuelcolvin/rtoml/main/example.py

# Install using the wheel
pip install rtoml
# This will get error
python example.py

# Alternatively, build from source
pip uninstall rtoml
apk add cargo
pip install rtoml --no-binary :all:

# This can be executed successfully
python example.py
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant