raysect / source

The main source repository for the Raysect project.
http://www.raysect.org
BSD 3-Clause "New" or "Revised" License
86 stars 23 forks source link

conda installation failure #427

Closed pelue closed 11 months ago

pelue commented 11 months ago

win10, specific conda environment with python 3.5.6, pip install raysect fails and reports

Installing build dependencies ... done Complete output from command python setup.py egg_info: Traceback (most recent call last): File "C:...\lib\multiprocessing\context.py", line 189, in get_context ctx = _concrete_contexts[method] KeyError: 'fork'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\...\pip-install-j71wjq1p\raysect\setup.py", line 8, in <module>
    multiprocessing.set_start_method('fork')
  File "C:\...\lib\multiprocessing\context.py", line 235, in set_start_method
    self._actual_context = self.get_context(method)
  File "C:\...\lib\multiprocessing\context.py", line 227, in get_context
    return super().get_context(method)
  File "C:\...\lib\multiprocessing\context.py", line 191, in get_context
    raise ValueError('cannot find context for %r' % method)
ValueError: cannot find context for 'fork'

any help, please?

vsnever commented 11 months ago

Hi @pelue, Raysect does not work on Windows out of the box. Raysect uses the fork method to create new processes not only at installation, but also at runtime. This minimizes memory usage during parallel computing thanks to copy-on-write paradigm. However, the fork method is supported only by Unix OSes (Linux, MacOS).

You can install Raysect on Windows via the Windows Subsystem for Linux (WSL), https://learn.microsoft.com/en-us/windows/wsl/install. You need WSL version >= 2.0

pelue commented 11 months ago

thank you very much. I will try then and in case I will be back.

pelue commented 11 months ago

I am also trying on an AFS system, still fails. Please see the attached file. Thanks error_AFS

vsnever commented 11 months ago

I am also trying on an AFS system, still fails. Please see the attached file. Thanks

Raysect is unlikely to work on Python versions older than 3.5. But if you get this error, it looks like you are using a Python version older than 3.4.

pelue commented 11 months ago

I am sorry, I thought to have checked. You are right, the output of python -V is 2.7.5. Thanks

pelue commented 11 months ago

Hello, I managed to install python 3.5.6 as well as cython, numpy, scipy and matplotlib. This is the error I get now:

Traceback (most recent call last): File "/.../lib/python3.5/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, *kwds)) File "/.../lib/python3.5/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/tmp/pip-build-env-zhkuzrkd/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 1345, in cythonize_one_helper return cythonize_one(*m) File "/tmp/pip-build-env-zhkuzrkd/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: raysect/core/math/spatial/kdtree3d.pyx """

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-6g4h69d2/raysect/setup.py", line 68, in <module>
    extensions = cythonize(extensions, nthreads=multiprocessing.cpu_count(), force=force, compiler_directives=cython_directives, annotate=annotate)
  File "/tmp/pip-build-env-zhkuzrkd/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 1145, in cythonize
    result.get(99999)  # seconds
  File "/.../lib/python3.5/multiprocessing/pool.py", line 644, in get
    raise self._value
Cython.Compiler.Errors.CompileError: raysect/core/math/spatial/kdtree3d.pyx

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-6g4h69d2/raysect/

I would still appreciate any help. Thanks

vsnever commented 11 months ago

Could you please indicate which version of Cython you have installed?

cython -V
vsnever commented 11 months ago

Also, Raysect 0.8.1 provides binary wheels for Python 3.7–3.9, so if you had a python version in that range, you wouldn't have to compile it yourself.

pelue commented 11 months ago

Hello, the version is 0.28.5. I did not know that there was a better compatibility with Python 3.7 or 3.9 from the raysect or cherab websites. So I can make a conda environment with 3.9 in case. Should I move to Python 3.9 then? Thanks for your help.

vsnever commented 11 months ago

Hello, the version is 0.28.5. I did not know that there was a better compatibility with Python 3.7 or 3.9 from the raysect or cherab websites. So I can make a conda environment with 3.9 in case. Thanks for your help.

Thanks. I can't guarantee that Raysect will compile with Cython version < 0.29.

I think the best way is to setup Python 3.9 environment and run:

pip install cherab

This will install Cherab 1.4 and all its dependencies, including the matching version of Raysect.

pelue commented 11 months ago

Thanks, it worked.