VicidominiLab / BrightEyes-MCS

BrightEyes Microscope Control Suite
GNU General Public License v3.0
3 stars 1 forks source link

Unable to compile/install #2

Closed raacampbell closed 2 months ago

raacampbell commented 2 months ago

Moving this problem from https://github.com/openjournals/joss-reviews/issues/7125 to an Issue.

The install.bat install method failed with miniconda for me. I made an environment and tried to install in that. After double-clicking on the icon I get an error window stating that the Cython modules can not be found. If I try to compile this happens:

(venv) (brighteyes) C:\Users\shopp\Downloads\BrightEyes-MCS-main\BrightEyes-MCS-main>python setup.py build_ext -inplace
No parent package detected, impossible to derive `name`
running build_ext
error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')

The response from @mattia-donato was:

I suppose you are not using Visual Studio compiler but msys2. In this case, python setup.py build_ext -inplace is not enough. You need to run from a terminal (with venv or conda activated) the compile_cython_msys2.bat which set some env variables and parameter to the compilation.

compile_cython_msys2.bat:

@REM VERSION WITH MSYS2
@ECHO This is the script to compile the Cython part of the code
@ECHO "msys2" must be installed on your system in the default folder (C:\msys64)
@ECHO you can download it from https://www.msys2.org/
@ECHO and inside msys2 environment gcc must be installed
@ECHO (you can install it inside msys2 environment with the
@ECHO command 'pacman -S mingw-w64-ucrt-x86_64-gcc' inside msys2 env)

SET PATH=%PATH%;C:\msys64\usr\bin;C:\msys64\ucrt64\bin
python setup.py build_ext --inplace --force --compiler=mingw32 -DMS_WIN64

I installed MSYS2 then in the window that came up ran pacman -S mingw-w64-ucrt-x86_64-gcc as instructed. After this, the compile script (compile_cython_msys2.bat) seems to do something but ends with many errors.

brighteyes_mcs/libs/cython/fastconverter.c: In function '__Pyx_ImportType_3_0_11':
brighteyes_mcs/libs/cython/fastconverter.c:30252:13: warning: unknown conversion type character 'z' in format [-Wformat=]
30252 |             "%s.%s size changed, may indicate binary incompatibility. "
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
brighteyes_mcs/libs/cython/fastconverter.c:30253:24: note: format string is defined here
30253 |             "Expected %zd from C header, got %zd from PyObject",
      |                        ^
brighteyes_mcs/libs/cython/fastconverter.c:30252:13: warning: unknown conversion type character 'z' in format [-Wformat=]
30252 |             "%s.%s size changed, may indicate binary incompatibility. "
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
brighteyes_mcs/libs/cython/fastconverter.c:30253:47: note: format string is defined here
30253 |             "Expected %zd from C header, got %zd from PyObject",
      |                                               ^
brighteyes_mcs/libs/cython/fastconverter.c:30252:13: warning: too many arguments for format [-Wformat-extra-args]
30252 |             "%s.%s size changed, may indicate binary incompatibility. "
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'C:\\msys64\\ucrt64\\bin\\gcc.exe' failed with exit code 1

(venv) (brighteyes) C:\Users\shopp\Downloads\BrightEyes-MCS-main\BrightEyes-MCS-main>

I suggest much more detailed and hand-holding install instructions, as the steps are not trivial.

mattia-donato commented 2 months ago

@raacampbell Thanks for your feedback!

I read that you use conda. Did you test the installation inside a conda env or in directly the system? t should be the same, but I worried that some packages are different. Actually the installation I used was using a "pure" Python and creating a venv from scratch without conda.

Could you please attach here the "pip freeze" (or the equivalent for conda) in the current env? Which version of Python are you using?

raacampbell commented 2 months ago

I did it in Conda with Python version 10

alabaster==1.0.0
annotated-types==0.7.0
anyio==4.4.0
app-model==0.2.8
appdirs==1.4.4
asttokens==2.4.1
atomics==1.0.2
attrs==24.2.0
babel==2.16.0
build==1.2.2
cachey==0.2.1
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cycler==0.12.1
Cython==0.29.37
darkdetect==0.7.1
dask==2024.9.0
debugpy==1.8.5
decorator==5.1.1
docstring_parser==0.16
docutils==0.21.2
exceptiongroup==1.2.2
executing==2.1.0
fastapi==0.114.2
flexcache==0.3
flexparser==0.3.1
fonttools==4.53.1
freetype-py==2.5.1
fsspec==2024.9.0
future==1.0.0
h5py==3.11.0
HeapDict==1.0.1
hsluv==5.0.4
idna==3.10
imageio==2.35.1
imagesize==1.4.1
importlib_metadata==8.5.0
in-n-out==0.2.1
ipykernel==6.29.5
ipython==8.27.0
jedi==0.19.1
Jinja2==3.1.4
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_client==8.6.2
jupyter_core==5.7.2
kiwisolver==1.4.7
lazy_loader==0.4
locket==1.0.0
magicgui==0.9.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdurl==0.1.2
napari==0.5.3
napari-console==0.0.9
napari-plugin-engine==0.2.0
napari-svg==0.2.0
nest-asyncio==1.6.0
networkx==3.3
nifpga==20.0.0
nifpga-fast-fifo-recv==0.101.3
npe2==0.7.7
numpy==1.26.4
numpydoc==1.8.0
packaging==24.1
pandas==2.2.2
parso==0.8.4
partd==1.4.2
pillow==10.4.0
Pint==0.24.3
platformdirs==4.3.3
pooch==1.8.2
prompt_toolkit==3.0.47
psutil==6.0.0
psygnal==0.11.1
pure_eval==0.2.3
pyconify==0.1.6
pycparser==2.22
pydantic==2.9.1
pydantic-compat==0.1.2
pydantic_core==2.23.3
Pygments==2.18.0
PyOpenGL==3.1.7
pyparsing==3.1.4
pyproject_hooks==1.1.0
pyqtdarktheme==2.1.0
pyqtgraph==0.12.4
PySide2==5.15.2.1
python-dateutil==2.9.0.post0
pytz==2024.2
pywin32==306
PyYAML==6.0.2
pyzmq==26.2.0
qtconsole==5.6.0
QtPy==2.4.1
referencing==0.35.1
requests==2.32.3
rich==13.8.1
rpds-py==0.20.0
scikit-image==0.24.0
scipy==1.14.1
shellingham==1.5.4
shiboken2==5.15.2.1
six==1.16.0
sniffio==1.3.1
snowballstemmer==2.2.0
Sphinx==8.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
starlette==0.38.5
superqt==0.6.7
tabulate==0.9.0
tifffile==2024.8.30
tomli==2.0.1
tomli_w==1.0.0
toolz==0.12.1
tornado==6.4.1
tqdm==4.66.5
traitlets==5.14.3
typer==0.12.5
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.3
vispy==0.14.3
wcwidth==0.2.13
wrapt==1.16.0
zipp==3.20.2
mattia-donato commented 2 months ago

Actually they looks like warnings and not errors, maybe the libraries actually are compiled.

Could please you try from that folder and in the venv the following command? python -c "import brighteyes_mcs.libs.cython.fastconverter as fc; print(fc.convertRawDataToCountsDirect.__name__)"

raacampbell commented 2 months ago

I will check on Monday, away now.

raacampbell commented 2 months ago

Sorry, I think I can't contribute more to finding a solution to this.

mattia-donato commented 2 months ago

Thank you for your feedback. I completly changed the installer script and finally now works also with conda. And I updated the README about the installation and the requirements.