svalinn / parastell

Parametric 3-D CAD modeling toolset for stellarator fusion devices
MIT License
27 stars 12 forks source link

Issue installing code OSX and Debian #179

Closed lazersos closed 3 days ago

lazersos commented 5 days ago

I'm having trouble getting parastell installed on either MacOS (12.7.6, x86) or on my Debian machine (GNU/Linux 12, 6.1.0-28-amd64, x86). On the mac I tried following your intall instructions using miniconda but when I try to run the example config.yml I get the following error:

../executables/parastell config.yaml
Traceback (most recent call last):
  File "/Users/lazerson/Sims_Work/PARASTELL/Examples/../executables/parastell", line 3, in <module>
    from parastell import parastell
  File "/Users/lazerson/Sims_Work/PARASTELL/parastell/parastell.py", line 5, in <module>
    import cubit
  File "/Applications/Coreform-Cubit-2023.11.app/Contents/lib/cubit.py", line 44, in <module>
    from cubit3 import *
  File "/Applications/Coreform-Cubit-2023.11.app/Contents/lib/cubit3.py", line 12, in <module>
    import _cubit3
ImportError: dlopen(/Applications/Coreform-Cubit-2023.11.app/Contents/lib/_cubit3.so, 0x0002): Symbol not found: (_iconv)
  Referenced from: '/Applications/Coreform-Cubit-2023.11.app/Contents/lib/libCATSysTS.dylib'
  Expected in: '/Users/lazerson/miniconda3/envs/parastell_env/lib/libiconv.2.dylib'

For reference Coreform-Cubit runs fine on it's own. This may be an OSX issue so no big deal, I have the Debian machine. However on that machine I get a different error:

WARNING:root:Mayavi not found. 3D plots will not work.
Traceback (most recent call last):
  File "/home/lazerson/src/parastell/Examples/../executables/parastell", line 3, in <module>
    from parastell import parastell
  File "/home/lazerson/src/parastell/parastell/parastell.py", line 10, in <module>
    from . import invessel_build as ivb
  File "/home/lazerson/src/parastell/parastell/invessel_build.py", line 8, in <module>
    import cadquery as cq
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/cadquery/__init__.py", line 22, in <module>
    from .occ_impl import exporters
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/cadquery/occ_impl/exporters/__init__.py", line 10, in <module>
    from ...cq import Workplane
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/cadquery/cq.py", line 62, in <module>
    from .sketch import Sketch
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/cadquery/sketch.py", line 28, in <module>
    from .occ_impl.sketch_solver import (
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/cadquery/occ_impl/sketch_solver.py", line 3, in <module>
    from nptyping import NDArray as Array
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/nptyping/__init__.py", line 32, in <module>
    from nptyping.ndarray import NDArray
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/nptyping/ndarray.py", line 40, in <module>
    from nptyping.shape import Shape
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/nptyping/shape.py", line 29, in <module>
    from nptyping.shape_expression import (
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/nptyping/shape_expression.py", line 36, in <module>
    from nptyping.typing_ import ShapeExpression, ShapeTuple
  File "/home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages/nptyping/typing_.py", line 51, in <module>
    Bool8 = np.bool8
            ^^^^^^^^
  File "/home/lazerson/.local/lib/python3.11/site-packages/numpy-2.0.0-py3.11-linux-x86_64.egg/numpy/__init__.py", line 410, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?
lazersos commented 5 days ago

This second issue seems to be related to the line in the environments.yml:

 - numpy=1.26.4

as the bool8 feature was depricated in 1.24, and I'm guessing removed by 1.26.4

lazersos commented 5 days ago

Update the issue seems to be with pystell_uw as it's build does not specify a version of numpy and so it's installing 2.0 which then meets the needs for parastell which of course it doesn't.

connoramoreno commented 4 days ago

Hi @lazersos, thanks for reaching out and apologies for the delay in response. Can you please confirm which version of NumPy is installed in your conda environment?

lazersos commented 4 days ago

@connoramoreno For my debian machine here's the output of creating the environment:

/home/lazerson/anaconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
  action(self, namespace, argument_values, option_string)
Retrieving notices: ...working... done
Channels:
 - conda-forge
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Installing pip dependencies: | Ran pip subprocess with arguments:
['/home/lazerson/anaconda3/envs/parastell_env/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt', '--exists-action=b']
Pip subprocess output:
Collecting git+https://github.com/aaroncbader/pystell_uw.git (from -r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4))
  Cloning https://github.com/aaroncbader/pystell_uw.git to /tmp/pip-req-build-ovccskbk
  Resolved https://github.com/aaroncbader/pystell_uw.git to commit 2993c6aba72d6c286dd21d2da3f2a7fb09156720
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting netcdf4 (from -r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 1))
  Using cached netCDF4-1.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.8 kB)
Collecting pyyaml (from -r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 2))
  Using cached PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting pytest (from -r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 3))
  Using cached pytest-8.3.3-py3-none-any.whl.metadata (7.5 kB)
Collecting cftime (from netcdf4->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 1))
  Using cached cftime-1.6.4.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.7 kB)
Requirement already satisfied: certifi in /home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages (from netcdf4->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 1)) (2024.8.30)
Requirement already satisfied: numpy in /home/lazerson/.local/lib/python3.11/site-packages/numpy-2.0.0-py3.11-linux-x86_64.egg (from netcdf4->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 1)) (2.0.0)
Collecting iniconfig (from pytest->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 3))
  Using cached iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: packaging in /home/lazerson/.local/lib/python3.11/site-packages/packaging-24.1-py3.11.egg (from pytest->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 3)) (24.1)
Collecting pluggy<2,>=1.5 (from pytest->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 3))
  Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: scipy in /home/lazerson/.local/lib/python3.11/site-packages/scipy-1.14.0-py3.11-linux-x86_64.egg (from pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (1.14.0)
Requirement already satisfied: matplotlib in /home/lazerson/.local/lib/python3.11/site-packages/matplotlib-3.9.1-py3.11-linux-x86_64.egg (from pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (3.9.1)
Requirement already satisfied: contourpy>=1.0.1 in /home/lazerson/.local/lib/python3.11/site-packages/contourpy-1.2.1-py3.11-linux-x86_64.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (1.2.1)
Requirement already satisfied: cycler>=0.10 in /home/lazerson/.local/lib/python3.11/site-packages/cycler-0.12.1-py3.11.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/lazerson/.local/lib/python3.11/site-packages/fonttools-4.53.1-py3.11.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (4.53.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/lazerson/.local/lib/python3.11/site-packages/kiwisolver-1.4.5-py3.11-linux-x86_64.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (1.4.5)
Requirement already satisfied: pillow>=8 in /home/lazerson/.local/lib/python3.11/site-packages/pillow-10.4.0-py3.11-linux-x86_64.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in /home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (3.2.0)
Requirement already satisfied: python-dateutil>=2.7 in /home/lazerson/.local/lib/python3.11/site-packages/python_dateutil-2.9.0.post0-py3.11.egg (from matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /home/lazerson/anaconda3/envs/parastell_env/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib->pystell==0.1.dev67+g2993c6a->-r /home/lazerson/src/parastell/condaenv.eyb7ri0s.requirements.txt (line 4)) (1.16.0)
Using cached netCDF4-1.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.3 MB)
Using cached PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (762 kB)
Using cached pytest-8.3.3-py3-none-any.whl (342 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Using cached cftime-1.6.4.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Building wheels for collected packages: pystell
  Building wheel for pystell (pyproject.toml): started
  Building wheel for pystell (pyproject.toml): finished with status 'done'
  Created wheel for pystell: filename=pystell-0.1.dev67+g2993c6a-py3-none-any.whl size=23982 sha256=27c4eb9016a5d5b68f1acbc2432734fdf81dbe2fb4973161443f38749b0c8578
  Stored in directory: /tmp/pip-ephem-wheel-cache-djzgo6uy/wheels/1a/2c/6d/47a091c21a7a7349cc16b97c05887a096e45d8ee02203b71dc
Successfully built pystell
Installing collected packages: pyyaml, pluggy, iniconfig, cftime, pytest, netcdf4, pystell
Successfully installed cftime-1.6.4.post1 iniconfig-2.0.0 netcdf4-1.7.2 pluggy-1.5.0 pystell-0.1.dev67+g2993c6a pytest-8.3.3 pyyaml-6.0.2

done
#
# To activate this environment, use
#
#     $ conda activate parastell_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate
connoramoreno commented 4 days ago

@lazersos, it doesn't seem that the output you've provided includes information about your NumPy installation. To retrieve information about your NumPy installation via conda, you can run the following command in your terminal (with the proper conda environment activated):

conda activate parastell_env
conda list numpy
lazersos commented 4 days ago

@connoramoreno Sorry here you go:

conda list numpy
# packages in environment at /home/lazerson/anaconda3/envs/parastell_env:
#
# Name                    Version                   Build  Channel
numpy                     1.24.0          py311hbde0eaa_0    conda-forge

But you can see from the orriginal error that the library issuing the error is :

/home/lazerson/.local/lib/python3.11/site-packages/numpy-2.0.0-py3.11-linux-x86_64.egg/numpy/__init__.p

I suspect the issue is that conda can only add to the environment. So since I have other packages installed with pip outside of conda it's picking up those.

connoramoreno commented 4 days ago

Just to confirm, did you have your conda environment activated when you ran the example?

lazersos commented 3 days ago

@connoramoreno Yes, from what I can tell Conda has a numpy 1.24.0 installed but pip has numpy 2.0.0 installed as well. And when the code is envoked, the pip version is the one which is picked up first.

lazersos commented 3 days ago

A bit more digging and issue seems to be that cadquery which is needed by cad_to_dagmc is currently broken via pip and presumably conda (https://github.com/CadQuery/cadquery/issues/1714).

connoramoreno commented 3 days ago

I'm unfamiliar with pip installations of CadQuery but we have not experienced any issues with conda versions yet. CadQuery is a major dependency of ParaStell and is the software toolset we use to generate all of our CAD models, so any issues with CadQuery would likely make themselves quickly apparent.

As you mentioned, it seems that the conflict is occurring because Python is importing a version of NumPy that is outside your conda environment. Here are some potential solutions:

lazersos commented 3 days ago

@connoramoreno Doing a pip uninstall numpy and then building the conda environment again seems to fix the issue. It's odd that the pip installations outside of conda would override conda. Anyway, thanks for the help.

adam-urbanczyk commented 2 days ago

A bit more digging and issue seems to be that cadquery which is needed by cad_to_dagmc is currently broken via pip and presumably conda (CadQuery/cadquery#1714).

AFAICT installation via conda is not broken, but if you have a reproducible problem, please open an issue.