MannLabs / alphapept

A modular, python-based framework for mass spectrometry. Powered by nbdev.
https://mannlabs.github.io/alphapept/
Apache License 2.0
167 stars 29 forks source link

'numpy.typing' has no attribute 'NDArray' #561

Closed AUldry closed 2 months ago

AUldry commented 2 months ago

Dear all,

I have been asked to install alphapept on a Windows 11 Education machine. I can install the program with the windows installer, which gives me the 0.5.0 version; this seems to work. Now I would like to install the 0.5.3, since it's available. I installed conda (miniconda) and created an alphapept environment, as described on your page. While everything installs without complaining, upon issuing alphapept gui, I get the following error:

NumpyArray = npt.NDArray[Any]

AttributeError: module 'numpy.typing' has no attribute 'NDArray'

Screen shot, exact error message and descriptions of my python environment are below. Should perhaps a package be forced to a particular version? Thank you in advance for your help!

Anne-Christine

Describe the bug alphapept gui does not start properly and spits out a "AttributeError: module 'numpy.typing' has no attribute 'NDArray'" error.

To Reproduce Steps to reproduce the behavior: Installed miniconda on Windows 11 Education conda create --name alphapept python=3.8 conda activate alphapept pip install "alphapept[stable,gui-stable]" alphapept gui

Results:


/   |  / /___  / /_  ____  / __ \___  ____  / /_

/ /| | / / \/ \/ \/ // / \/ \/ / / _ |/ / // / / / / // / __/ _/ // / / // |/_/ .// //_,// _/ ./\/ // /_/ .................................................... . https://github.com/MannLabs/alphapept . . Mann Labs . . 0.5.3 . ....................................................

Starting AlphaPept Background Process 2024-07-01 13:50:33.354 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager Starting AlphaPept Server

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8505 Network URL: http://130.92.40.214:8505

2024-07-01 13:50:34.176 Uncaught app exception Traceback (most recent call last): File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_script exec(code, module.dict) File "C:\Users\pmscf\miniconda3\envs\alphapept\Lib\site-packages\alphapept\webui.py", line 2, in from alphapept.gui import history, results, filewatcher, status, experiment, fasta, start, constants File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\alphapept\gui\history.py", line 4, in import plotly.express as px File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\plotly\express__init__.py", line 14, in from ._imshow import imshow File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\plotly\express_imshow.py", line 8, in from plotly.utils import image_array_to_data_uri File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\plotly\utils.py", line 5, in from _plotly_utils.data_utils import * File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages_plotly_utils\data_utils.py", line 6, in from PIL import Image File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\PIL\Image.py", line 68, in from ._typing import StrOrBytesPath, TypeGuard File "C:\Users\pmscf\miniconda3\envs\alphapept\lib\site-packages\PIL_typing.py", line 10, in NumpyArray = npt.NDArray[Any] AttributeError: module 'numpy.typing' has no attribute 'NDArray' 2024-07-01 13:50:37.064 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager 2024-07-01 13:50:37.314385 Started queue_watcher

See screenshot of http://localhost:8505/

Expected behavior GUI

Screenshots Screenshot_2024-07-01_13-51-31

Version (please complete the following information):

Additional context Python version: Python 3.8.19 (default, Mar 20 2024, 19:55:45) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

pip list:

Package Version


alphabase 1.2.1 alphapept 0.5.3 alpharaw 0.1.0 alphatims 1.0.7 altair 5.3.0 attrs 23.2.0 biopython 1.79 blinker 1.8.2 cachetools 5.3.3 certifi 2024.6.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 cloudpickle 3.0.0 clr-loader 0.2.6 colorama 0.4.6 contextlib2 21.6.0 contourpy 1.1.1 cycler 0.12.1 dask 2023.5.0 fastcore 1.5.26 fonttools 4.53.0 fsspec 2024.6.1 gitdb 4.0.11 GitPython 3.1.43 greenlet 3.0.3 h5py 3.7.0 idna 3.7 importlib_metadata 8.0.0 importlib_resources 6.4.0 Jinja2 3.1.4 joblib 1.4.2 jsonschema 4.22.0 jsonschema-specifications 2023.12.1 kiwisolver 1.4.5 llvmlite 0.38.1 locket 1.0.0 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.6.1 mdurl 0.1.2 networkx 2.8.6 numba 0.55.2 numexpr 2.8.6 numpy 1.20.3 packaging 24.1 pandas 2.0.1 partd 1.4.1 patsy 0.5.6 pillow 10.4.0 pip 24.0 pkgutil_resolve_name 1.3.10 plotly 5.22.0 plotly-express 0.4.1 protobuf 5.27.2 psutil 5.9.1 pyahocorasick 2.1.0 pyarrow 16.1.0 pycparser 2.22 pydeck 0.9.1 Pygments 2.18.0 pyparsing 3.1.2 pyteomics 4.5.5 python-dateutil 2.9.0.post0 pythonnet 3.0.3 pytz 2024.1 pywin32 306 PyYAML 6.0 pyzstd 0.16.0 referencing 0.35.1 regex 2024.5.15 requests 2.32.3 rich 13.7.1 rpds-py 0.18.1 scikit-learn 1.1.2 scipy 1.8.1 setuptools 69.5.1 six 1.16.0 smmap 5.0.1 SQLAlchemy 1.4.39 statsmodels 0.14.1 streamlit 1.36.0 tables 3.6.1 tenacity 8.4.2 threadpoolctl 3.5.0 toml 0.10.2 toolz 0.12.1 tornado 6.4.1 tqdm 4.64.0 typing_extensions 4.12.2 tzdata 2024.1 urllib3 2.2.2 watchdog 2.1.9 wget 3.2 wheel 0.43.0 xxhash 3.4.1 zipp 3.19.2

straussmaximilian commented 2 months ago

Hi, this looks like an issue coming from PIL. Can you try the following?

conda create --name alphapept python=3.8 -y
conda activate alphapept
conda install pillow
pip install "alphapept[stable,gui-stable]"
alphapept gui
AUldry commented 2 months ago

Dear Maximilian,

Many many thanks for your reply! You were right that this had to do with pillow. The solution to re-install it via conda did not work for me (got a different error message, a complain that a DLL could not be found), but with these 2 clues, I found randomly on the web that pillow==9.0.0 worked for somebody... and it worked for me too (with python 3.8.19). So all good now, thanks again!