Closed jverpeut closed 10 months ago
Hi @jverpeut,
The error message definitely seems to point to a version discrepancy in which Qt
was pulled in.... but it is strange that this happened after updating the anaconda navigator. Do you know if you have multiple version of anaconda installed on your computer? This might cause some conda-confusion for where packages should be pulled in from.
I think you listed the environment packages for your base environment ("packages in environment at C:\miniforge3:
"), do you mind activating the sleap
environment and listing the packages in the sleap
environment?
Thanks, Liezl
I believe I just have the one instance of anaconda. Below is what I have on my local computer. I will say that sleap 1.3.3 would not work our cluster as well (error message below and I thought it was unrelated at the time), but my local IT just solved it. I will copy what packages they installed below my local install.
Formatted version of above using this function.
(Differing) dependency comparison [local v. mine]
Package Name | local | my_env |
---|---|---|
importlib-metadata | 4.10.0 | 4.2.0 |
libaec | 1.1.1 | 1.1.2 |
zipp | 3.6.0 | 3.15.0 |
This comparison might give us better results as it seems the cluster has many other packages installed that are not present in either my own environment not the local environment.
HI @jverpeut,
Even though your environment shows the expected versions of qtpy
and pyside2
, to cover the basis can you double check the import by running the following command in your sleap environment:
python -c "import qtpy; from qtpy import QtCore; print(qtpy.__version__); print(QtCore.Qt.SortOrder)"
Thanks, Liezl
C:\Users\jverpeut>python -c "import qtpy; from qtpy import QtCore; print(qtpy.version); print(QtCore.Qt.SortOrder)" 2.4.0 <class 'PyQt5.QtCore.Qt.SortOrder'>
Hmm ok... So it looks like you have PyQt5 being abstracted by qtpy
whereas I have PySide2:
(spkg) C:\Users\TalmoLab>python -c "import qtpy; from qtpy import QtCore; print(qtpy.__version__); print(QtCore.Qt.SortOrder)"
2.4.0
<class 'PySide2.QtCore.Qt.SortOrder'>
so, where did the PyQt5 come from...
If I try to install PySide2: Requirement already satisfied: PySide2 in c:\miniforge3\envs\sleap3\lib\site-packages (5.14.1) Requirement already satisfied: shiboken2==5.14.1 in c:\miniforge3\envs\sleap3\lib\site-packages (from PySide2) (5.14.1)
I double checked our repo to make sure we aren't listing pyqt as a requirement anywhere and we are not.
I'm pretty sure that PyQt5
is pip installed (although there is a package pyqt-sip on the conda-forge channel). If it is pip installed, then we should be able to locate where it is installed with
pip show pyqt5
It's possible that user installed packages are being allowed into the conda environments - we'll draw some conclusions once we know the path.
(sleap3) C:\Users\jverpeut>pip show pyqt5 Name: PyQt5 Version: 5.9.2 Summary: Python bindings for the Qt cross platform UI and application toolkit Home-page: https://www.riverbankcomputing.com/software/pyqt/ Author: Riverbank Computing Limited Author-email: info@riverbankcomputing.com License: GPL v3 Location: c:\users\jverpeut\appdata\roaming\python\python37\site-packages Requires: sip Required-by:
Aha ok definitely using user packages from outside the conda environment... We encountered this one time before:
TLDR It seems the workaround is to run the command
set PYTHONNOUSERSITE=True
(set
for Windows,export
for Linux) before runningconda activate <name of environment>
which will prevent the conda environment from accessing user site-package.
By looking at the path
"C:\Users\ShaevitzLab\AppData\Roaming\Python\Python37\site-packages\cv2"
, it seems that python37 is attempting to import your global install ofcv2
. We want python to use the conda environment's pip install ofcv2
which would be located at"C:\Anaconda3\envs\sleap_id\lib\site-packages\cv2"
. From the output ofconda list
, we know that you haveopencv-python
andopencv-python-headless
installed in the environment, we just need to get python37 to use this installation instead of the global installation.This issue arises because you have the same version of python installed globally as we currently use in SLEAP (python37). Per PEP370, to be considered a "standard python distribution", conda needs to allow same versions of python to access globally installed python packages - there is a whole list of issues revolving around this on conda's github, but it's a PEP standard so not a whole lot to do other than manually disable access to user site-packages.
Let us know how that works.
Thanks, Liezl
Originally posted by @roomrys in https://github.com/talmolab/sleap/issues/827#issuecomment-1176537974
Note that the set
command will only set the variable in that instance of the terminal. If you would like to permanently remember the environment variable, then you would need to use
setx PYTHONNOUSERSITE True
(no equals unlike in set
). You might need to open a new terminal to see the effects of setx
with an
echo %PYTHONNOUSERSITE%
Ok, that gave me another error:
(sleap3) C:\Users\jverpeut>sleap-label
Traceback (most recent call last):
File "C:\miniforge3\envs\sleap3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\miniforge3\envs\sleap3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\miniforge3\envs\sleap3\Scripts\sleap-label.exe__main.py", line 4, in
Argh, but you have psutil
installed as shown in your conda list
🤯
psutil 5.9.3 py37h51bd9d9_0 conda-forge
What is the output of
pip show psutil
and
mamba repoquery whoneeds psutil
?
Maybe there is something wrong with my miniforge installation?
(base) C:\WINDOWS\system32>mamba activate sleap3
(sleap3) C:\WINDOWS\system32>pip show psutil Name: psutil Version: 5.9.5 Summary: Cross-platform lib for process and system monitoring in Python. Home-page: https://github.com/giampaolo/psutil Author: Giampaolo Rodola Author-email: g.rodola@gmail.com License: BSD-3-Clause Location: c:\users\jverpeut\appdata\roaming\python\python37\site-packages Requires: Required-by: ipykernel
(sleap3) C:\WINDOWS\system32>mamba repoquery whoneeds psutil 'mamba' is not recognized as an internal or external command, operable program or batch file.
Well, there could be a few different things going on
conda env list
and see if there are any environments in a different location) - although you already checked this - and/orI still wouldn't expect to be able to find the psutil
package from within your conda (regardless of which conda/mamba) environment if PYTHONNOUSERSITE
is set (and verified with echo %PYTHONNOUSERSITE%
which should print True
if set).
Occasionally the wrong pip
is referenced, kind of the same idea as what the PYTHONNOUSERSITE
variable tries to avoid. I wonder which pip
we are using here
pip show pip
If pip
is from outside the environment, then my hypothesis would be that when installing the SLEAP library maybe instead of using the pip
that is supposed to be installed and isolated within the environment, we used the pip
outside the environment which installed things outside of the environment as well. OR, a subset of packages to be pip
installed were already installed in your global user site-packages and since PYTHONNOUSERSITE
was not set on installation, then pip
opted to not install those packages since they were already globally installed.
Just a few wild guesses as of right now - I would check that echo %PYTHONNOUSERSITE%
returns True
first and also find the Miniforge prompt and maybe do a conda env list
.
Sounds good.
(sleap3) C:\WINDOWS\system32>echo %PYTHONNOUSERSITE%
True
Environment:
(base) C:\Users\jverpeut>conda env list
# conda environments:
#
C:\ProgramData\Anaconda3
C:\ProgramData\anaconda3
C:\ProgramData\anaconda3\envs\cytomod
C:\ProgramData\anaconda3\envs\py39
bsoid_v2 C:\Users\jverpeut\.conda\envs\bsoid_v2
py36 C:\Users\jverpeut\.conda\envs\py36
base * C:\miniforge3
sleap3 C:\miniforge3\envs\sleap3
(sleap3) C:\WINDOWS\system32>pip show pip
Name: pip
Version: 22.3.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: distutils-sig@python.org
License: MIT
Location: c:\miniforge3\envs\sleap3\lib\site-packages
Requires:
Required-by:
Ok, so we do have two separate installations of software to interact with conda (anaconda3 and miniforge3). Note the paths to some environments (stored in the envs
directory) are different than others, namely
C:\ProgramData\anaconda3\envs
C:\miniforge3\envs
You have 4 environments using anaconda3 (cytomod
, py39
, bsoid_v2
, and py36
) and only one using miniforge3 (sleap3
).
Assuming you are using all your environments and seeing as most are in anaconda3, I would suggest that we
conda
base command instead of mamba
If you already have Anaconda on your computer, then you can set the solver to libmamba in the base environment (and skip the Mambaforge installation):
conda update -n base conda conda install -n base conda-libmamba-solver conda config --set solver libmamba _the note that's probably easily overlooked in [this section](https://sleap.ai/installation.html#installing-mambaforge)_
Setting the solver to libmamba will help us get the faster dependency resolution that we want, but just means that instead of using the mamba
command, we need to use the conda
command. It also means we can't use some special features of mamba
like the mamba repoquery
command, but that's no biggy.
The conda
command to install which I think you have already been using is
conda create -y -n sleap -c conda-forge -c nvidia -c sleap -c anaconda sleap=1.3.3
I had tried this installation in this way previously, but I started over and deleted miniforge and followed these steps.
Now I have these environments:
C:\ProgramData\Anaconda3
base C:\ProgramData\anaconda3
cytomod C:\ProgramData\anaconda3\envs\cytomod
py39 C:\ProgramData\anaconda3\envs\py39
bsoid_v2 C:\Users\jverpeut\.conda\envs\bsoid_v2
py36 C:\Users\jverpeut\.conda\envs\py36
sleap * C:\Users\jverpeut\.conda\envs\sleap
I am still seeing the same error as I originally had:
Saving config: C:\Users\jverpeut/.sleap/1.3.3/preferences.yaml
Traceback (most recent call last):
File "C:\Users\jverpeut\.conda\envs\sleap\Scripts\sleap-label-script.py", line 33, in <module>
sys.exit(load_entry_point('sleap==1.3.3', 'console_scripts', 'sleap-label')())
File "C:\Users\jverpeut\.conda\envs\sleap\Scripts\sleap-label-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Users\jverpeut\.conda\envs\sleap\lib\site-packages\importlib_metadata\__init__.py", line 167, in load
module = import_module(match.group('module'))
File "C:\Users\jverpeut\.conda\envs\sleap\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\jverpeut\.conda\envs\sleap\lib\site-packages\sleap\gui\app.py", line 64, in <module>
from sleap.gui.dialogs.metrics import MetricsTableDialog
File "C:\Users\jverpeut\.conda\envs\sleap\lib\site-packages\sleap\gui\dialogs\metrics.py", line 11, in <module>
from sleap.gui.dataviews import GenericTableModel, GenericTableView
File "C:\Users\jverpeut\.conda\envs\sleap\lib\site-packages\sleap\gui\dataviews.py", line 35, in <module>
class GenericTableModel(QtCore.QAbstractTableModel):
File "C:\Users\jverpeut\.conda\envs\sleap\lib\site-packages\sleap\gui\dataviews.py", line 210, in GenericTableModel
order: QtCore.Qt.SortOrder = QtCore.Qt.SortOrder.AscendingOrder,
AttributeError: type object 'SortOrder' has no attribute 'AscendingOrder'
I updated my anaconda navigator and miniforge stopped opening sleap. I deleted miniforge, redownloaded, then reinstalled sleap 1.3.3 and it still will not open. I have been trying to diagnose if it is maybe a Qt error, but haven't found anything that works yet.
Your personal set up
Environment packages
``` # packages in environment at C:\miniforge3: # # Name Version Build Channel boltons 23.0.0 pyhd8ed1ab_0 conda-forge brotli-python 1.1.0 py310h00ffb61_0 conda-forge bzip2 1.0.8 h8ffe710_4 conda-forge ca-certificates 2023.7.22 h56e8100_0 conda-forge certifi 2023.7.22 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py310h628cb3f_3 conda-forge charset-normalizer 3.2.0 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge conda 23.3.1 py310h5588dad_0 conda-forge conda-libmamba-solver 23.3.0 pyhd8ed1ab_0 conda-forge conda-package-handling 2.2.0 pyh38be061_0 conda-forge conda-package-streaming 0.9.0 pyhd8ed1ab_0 conda-forge cryptography 41.0.3 py310h6e82f81_0 conda-forge fmt 9.1.0 h181d51b_0 conda-forge idna 3.4 pyhd8ed1ab_0 conda-forge jsonpatch 1.32 pyhd8ed1ab_0 conda-forge jsonpointer 2.0 py_0 conda-forge krb5 1.21.2 heb0366b_0 conda-forge libarchive 3.6.2 h6f8411a_1 conda-forge libcurl 8.2.1 hd5e4a3a_0 conda-forge libffi 3.4.2 h8ffe710_5 conda-forge libiconv 1.17 h8ffe710_0 conda-forge libmamba 1.4.2 h8a7d157_0 conda-forge libmambapy 1.4.2 py310h3fe4c2e_0 conda-forge libsolv 0.7.24 h12be248_3 conda-forge libsqlite 3.43.0 hcfcfb64_0 conda-forge libssh2 1.11.0 h7dfc565_0 conda-forge libxml2 2.11.5 hc3477c8_1 conda-forge libzlib 1.2.13 hcfcfb64_5 conda-forge lz4-c 1.9.4 hcfcfb64_0 conda-forge lzo 2.10 he774522_1000 conda-forge mamba 1.4.2 py310hd9d798f_0 conda-forge menuinst 1.4.19 py310h5588dad_1 conda-forge miniforge_console_shortcut 1.0 h57928b3_0 conda-forge openssl 3.1.2 hcfcfb64_0 conda-forge packaging 23.1 pyhd8ed1ab_0 conda-forge pip 23.2.1 pyhd8ed1ab_0 conda-forge pluggy 1.3.0 pyhd8ed1ab_0 conda-forge pybind11-abi 4 hd8ed1ab_3 conda-forge pycosat 0.6.4 py310h8d17308_1 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pyopenssl 23.2.0 pyhd8ed1ab_1 conda-forge pysocks 1.7.1 pyh0701188_6 conda-forge python 3.10.12 h4de0772_0_cpython conda-forge python_abi 3.10 3_cp310 conda-forge reproc 14.2.4 hcfcfb64_0 conda-forge reproc-cpp 14.2.4 h63175ca_0 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge ruamel.yaml 0.17.32 py310h8d17308_0 conda-forge ruamel.yaml.clib 0.2.7 py310h8d17308_1 conda-forge setuptools 68.1.2 pyhd8ed1ab_0 conda-forge tk 8.6.12 h8ffe710_0 conda-forge toolz 0.12.0 pyhd8ed1ab_0 conda-forge tqdm 4.66.1 pyhd8ed1ab_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge urllib3 2.0.4 pyhd8ed1ab_0 conda-forge vc 14.3 h64f974e_17 conda-forge vc14_runtime 14.36.32532 hfdfe4a8_17 conda-forge vs2015_runtime 14.36.32532 h05e6639_17 conda-forge wheel 0.41.2 pyhd8ed1ab_0 conda-forge win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge xz 5.2.6 h8d14728_0 conda-forge yaml-cpp 0.7.0 h63175ca_2 conda-forge zstandard 0.19.0 py310h8d17308_0 conda-forge zstd 1.5.5 h12be248_0 conda-forge ```