Closed VooDisss closed 6 months ago
This looks like a broken Cadquery install, nlopt is attempting to be imported by Cadquery. How did you install Cadquery? I recommend pip, it should automatically pull in the dependencies.
For what it's worth, I've got nlopt 2.7.1 on my machine.
Thanks for pointing to the nlopt version. The issue was that python 3.12 and 3.11 does not support nlopt 2.7.1. I had to install python 3.10.11 from here: https://www.python.org/downloads/windows/ Cause i wanted to remain my python3.12 version installed, i went to the folder of python 3.10, launched cmd in that folder, installed cadquery and nlopt2.7.1 using these commands:
**python -m pip install cadquery
python -m pip install nlopt**
Then i went to the folder which contains calistar.py, launched cmd there and wrote command like this:
C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\python.exe calistar.py
and got output with:
1.5707963267948966 1.5707963267948966 -1.5707963267948966 1.5707963267948966 -1.5707963267948966 1.5707963267948966 1.5707963267948966 1.5707963267948966 1.5707963267948966 0.0 3.141592653589793 1.5707963267948966 1.5707963267948966 1.5707963267948966 1.5707963267948966 0.0 3.141592653589793 1.5707963267948966 1.5707963267948966 1.5707963267948966 1.5707963267948966 0.0 3.141592653589793 1.5707963267948966 1.5707963267948966 0.0 0.0 1.5707963267948966 0.0 Traceback (most recent call last): File "E:\ACloud\Random stuff\3dprint\fleur_de_cali-main\calistar.py", line 188, in <module> show_object(result) NameError: name 'show_object' is not defined
Yup, that last one's a bug of sorts. show_object is a command built into Cadquery's editor cq-editor. If you're not using that (e.g. running from the command line) it'll crash like that.
I'll wrap it in a try/except next update. In the meantime, you should be able to comment it out and it'll run fine.
Edit: "it" referring to line 188 which contains "show_object(result)"
If anyone needs to downgrade python to version 3.10.11, you can change the priority of which python version is used by doing so:
After new update and these things i wrote - calistar.py started working for me
It seems something is wrong with nlopt, so I would need to know which version of nlopt is compatible with this script, otherwise i do not know what the solution is... It's strange that this tool does not get much attention compared to califlower...
py calistar.py
`Traceback (most recent call last): File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\nlopt\nlopt.py", line 22, in swig_import_helper return importlib.import_module(mname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\importlib__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 921, in _load_unlocked
File "", line 813, in module_from_spec
File "", line 1289, in create_module
File "", line 488, in _call_with_frames_removed
ImportError: DLL load failed while importing _nlopt: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "E:\ACloud\Random stuff\3dprint\fleur_de_cali-main\calistar.py", line 1, in
import cadquery as cq
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\cadquery__init.py", line 22, in
from .occ_impl import exporters
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\cadquery\occ_impl\exporters__init.py", line 10, in
from ...cq import Workplane
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\cadquery\cq.py", line 62, in
from .sketch import Sketch
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\cadquery\sketch.py", line 28, in
from .occ_impl.sketch_solver import (
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\cadquery\occ_impl\sketch_solver.py", line 10, in
import nlopt
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\nlopt\ init__.py", line 1, in
from .nlopt import *
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\nlopt\nlopt.py", line 25, in
_nlopt = swig_import_helper()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\VooDoo\AppData\Roaming\Python\Python312\site-packages\nlopt\nlopt.py", line 24, in swig_import_helper
return importlib.import_module('_nlopt')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\importlib\ init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_nlopt'`