Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Broken installation due to probable circular import #57

Closed
Mattia9875 opened this issue Feb 17, 2021 · 10 comments · Fixed by #62
Closed

Broken installation due to probable circular import #57

Mattia9875 opened this issue Feb 17, 2021 · 10 comments · Fixed by #62
Assignees

Comments

@Mattia9875
Copy link

Mattia9875 commented Feb 17, 2021

Hi, i'm currently using docker to try and make a container out of symbiflow but i am encountering this issue when i try and call for the fasm command.
Here is the dockerfile

FROM continuumio/miniconda3 
WORKDIR /symb
ENV INSTALL_DIR=/symb
ENV FPGA_FAM=xc7
RUN apt update && \
    apt install -y git wget picocom xz-utils
RUN git clone https://github.com/SymbiFlow/symbiflow-examples && \
    cd symbiflow-examples
RUN conda env create -f ${INSTALL_DIR}/symbiflow-examples/${FPGA_FAM}/environment.yml
RUN mkdir -p $INSTALL_DIR/xc7/install && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/112/20201208-080919/symbiflow-arch-defs-install-7c1267b7.tar.xz | tar -xJC $INSTALL_DIR/xc7/install       && \
    wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/112/20201208-080919/symbiflow-arch-defs-xc7a50t_test-7c1267b7.tar.xz | tar -xJC $INSTALL_DIR/xc7/install
RUN echo "source activate xc7" > ~/.bashrc
ENV PATH="$PATH:/symb/xc7/install/bin"

Here is the issue

(xc7) root@caaa33124948:/symb# fasm
/opt/conda/envs/xc7/lib/python3.7/site-packages/fasm/parser/__init__.py:27: RuntimeWarning: 
Falling back on slower textX parser implementation:
  ImportError: cannot import name 'antlr_to_tuple' from 'fasm.parser' (/opt/conda/envs/xc7/lib/python3.7/site-packages/fasm/parser/__init__.py)
Please install all dependencies and reinstall with:
  pip uninstall
  pip install -v fasm
  '  pip install -v fasm'.format(e), RuntimeWarning)
Traceback (most recent call last):
  File "/opt/conda/envs/xc7/bin/fasm", line 5, in <module>
    from fasm import main
ImportError: cannot import name 'main' from 'fasm' (/opt/conda/envs/xc7/lib/python3.7/site-packages/fasm/__init__.py)

While trying to use the repo in an isolated environment i get the same issue but with a Circular Import warning hence the name of the issue

@mithro
Copy link
Contributor

mithro commented Feb 17, 2021

@Mattia9875 -- Ignore the ImportWarning for now. Could you include the output of the dockerfile run?

(BTW You want to wrap your output in triple backticks to make github format it correctly.)

@Mattia9875
Copy link
Author

I am testing in interactive mode, i have no other output sorry

@litghost
Copy link
Collaborator

litghost commented Feb 17, 2021

fasm/__init__.py has no main method, which is why the import failed. The interactive module of fasm is fasm.tool, like json.tool. The error is not causes by a circular import, but instead is caused by setup.py pointing to the wrong entry point, see: https://github.com/SymbiFlow/fasm/blob/8fb1946b73cdb3222877a246a0e032f1b37d754c/setup.py#L253

@Mattia9875
Copy link
Author

Is there something i can do to fix it in my installation or is it a general issue?

@litghost
Copy link
Collaborator

litghost commented Feb 17, 2021

Is there something i can do to fix it in my installation or is it a general issue?

Nothing is broken per say. None of the downstream tooling depends on the console script. Rather than invoking the fasm tool with fasm, just invoke python3 -mfasm.tool. You are welcome to submit a PR changing setup.py and verifying it addresses your original issue.

@mithro
Copy link
Contributor

mithro commented Feb 17, 2021

@Mattia9875 - A pull request which changes the setup.py line to fasm=fasm.tool:main (I think?) and potentially adds a test to the CI would be very welcome!

@Mattia9875
Copy link
Author

Thank you,should i submit a issue pointing to this one in symbiflow-examples? beacuse with the current makefile the examples are not buildable

@litghost
Copy link
Collaborator

Thank you,should i submit a issue pointing to this one in symbiflow-examples? beacuse with the current makefile the examples are not buildable

I don't believe any of the makefiles in symbiflow-examples depend on the console script being correct. Do you have an example where that is the case?

@Mattia9875
Copy link
Author

My bad, i've mistaken the warning for an error, thanks for the support and the kindness!

mithro added a commit to mithro/fasm that referenced this issue Feb 19, 2021
Fixes chipsalliance#57.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
@mithro
Copy link
Contributor

mithro commented Feb 19, 2021

Should be fixed soon by #62

@mithro mithro self-assigned this Feb 19, 2021
mithro added a commit to mithro/fasm that referenced this issue Feb 19, 2021
Fixes chipsalliance#57.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants