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

ImportError: cannot import name 'zoom' from 'ezdxf' (/opt/conda/lib/python3.12/site-packages/ezdxf/__init__.py) #1704

Closed
pmbaumgartner opened this issue Nov 17, 2024 · 17 comments

Comments

@pmbaumgartner
Copy link

On a fresh install (on macOS, using docker) I get:

ImportError: cannot import name 'zoom' from 'ezdxf' (/opt/conda/lib/python3.12/site-packages/ezdxf/__init__.py)

full traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.12/site-packages/cadquery/__init__.py", line 22, in <module>
    from .occ_impl import exporters
  File "/opt/conda/lib/python3.12/site-packages/cadquery/occ_impl/exporters/__init__.py", line 18, in <module>
    from .dxf import exportDXF, DxfDocument
  File "/opt/conda/lib/python3.12/site-packages/cadquery/occ_impl/exporters/dxf.py", line 6, in <module>
    from ezdxf import units, zoom
ImportError: cannot import name 'zoom' from 'ezdxf' (/opt/conda/lib/python3.12/site-packages/ezdxf/__init__.py)
@jmwright
Copy link
Member

I cannot reproduce on MacOS and Python 3.12.2 in a clean conda environment.

@kariem2k
Copy link

This is happening to me too on Windows (Clean Conda installation). I tried 2.4 and master both cause the same error.

@jmwright
Copy link
Member

Can you run conda list in your environment and post it here?

@kariem2k
Copy link

Of course
condalist.txt

Attached the file.

@jmwright
Copy link
Member

jmwright commented Jan 1, 2025

The version of ezdxf that output is showing is not even close to the current release. The oldest version I can find in my Linux environments is 1.1.0. I don't see any reason why conda would be installing an earlier version (a Windows package is available).

https://anaconda.org/conda-forge/ezdxf

Can you try to force the installation of 1.3.0 in your conda environment?

@jmwright
Copy link
Member

jmwright commented Jan 7, 2025

@pmbaumgartner @kariem2k Are either of you able to try the potential solution above?

@shimwell
Copy link
Contributor

shimwell commented Jan 8, 2025

Just to mention this was thread useful for me.

Yesterday I was making a conda package that used cadquery 2.5.2 and noticed the same import error. Enforcing version 1.3.0 or newer solved the issue when making a conda package

Today I've also tried to update another package to use cadquery 2.5.2 and noticed the same error. I've tried reworking the CI and adding a min version for the ezdxf package of 1.3.0 but couldn't get the ci to pass still. I have got this output log if it helps diagnose the error,
ci-log.md

@jmwright
Copy link
Member

jmwright commented Jan 8, 2025

@adam-urbanczyk Should we pin the version of ezdxf in environment.yml to force conda to use a current version?

https://github.com/CadQuery/cadquery/blob/master/environment.yml#L16

@shimwell
Copy link
Contributor

shimwell commented Jan 8, 2025

Would that also work for users installing with pip ?

@jmwright
Copy link
Member

jmwright commented Jan 8, 2025

@shimwell I have not seen evidence that pip is affected, have you? It seems like a conda solver issue. We could go ahead and add the pin to setup.py for completeness anyway.

@shimwell
Copy link
Contributor

shimwell commented Jan 8, 2025

I've not seen any cadquery 2.5.2 pip install breakages, sorry I just assumed

@jmwright
Copy link
Member

jmwright commented Jan 8, 2025

@shimwell No worries. Some conda and pip packages are also maintained separately, so the versions do not always match up (one can lag the other). So that adds another layer of consideration to this. However, I do see that PyPI has version 1.3.0 of ezdxf and above, so we could add the pin for >=1.3.0 to setup.py as well to be more consistent between environments.

@jmwright
Copy link
Member

jmwright commented Jan 8, 2025

I created #1746 to see if we can fix this.

@jmwright
Copy link
Member

jmwright commented Jan 8, 2025

#1746 has been merged. I think it usually takes a few hours for the packages to be available on conda-forge. Can someone who can reproduce this issue test a conda master install of CadQuery when the new packages are available? I believe you can watch for the new master package on conda-forge. When it is available there, you can try the install.

https://anaconda.org/CadQuery/cadquery/files

@adam-urbanczyk
Copy link
Member

Actually I need to update the recipe there.

@adam-urbanczyk
Copy link
Member

adam-urbanczyk commented Jan 9, 2025

Done, @shimwell could you check if it solves the problem?

@shimwell
Copy link
Contributor

shimwell commented Jan 9, 2025

Yes this solves it form me. Many thanks
I have now got passing CI for this PR
Also I was able to remove the ezdxf min version pin that I had in this package and it now builds without that

@jmwright jmwright closed this as completed Jan 9, 2025
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

No branches or pull requests

5 participants