Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install label-studio with anaconda #3907

Closed
ODAncona opened this issue Mar 25, 2023 · 8 comments
Closed

Unable to install label-studio with anaconda #3907

ODAncona opened this issue Mar 25, 2023 · 8 comments
Assignees
Labels
installation problem bug or something isn't working

Comments

@ODAncona
Copy link

Describe the bug
I'm unable to install label-studio on my computer.

To Reproduce
Steps to reproduce the behavior:

  1. conda create -n ml
  2. python3 --version
  3. conda install pandas scipy scikit-learn numpy seaborn nltk
  4. python3 --version
  5. pip install -U label-studio
  6. label-studio

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

=> Database and media directory: /home/olivier/.local/share/label-studio
=> Static URL is set to: /static/
=> Database and media directory: /home/olivier/.local/share/label-studio
=> Static URL is set to: /static/
Traceback (most recent call last):
  File "/home/olivier/anaconda3/envs/ml/bin/label-studio", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/label_studio/server.py", line 290, in main
    _setup_env()
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/label_studio/server.py", line 40, in _setup_env
    application = get_wsgi_application()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/label_studio/core/settings/label_studio.py", line 48, in <module>
    from label_studio.core.utils.common import collect_versions
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/label_studio/core/utils/common.py", line 19, in <module>
    import drf_yasg.openapi as openapi
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/drf_yasg/openapi.py", line 11, in <module>
    from .utils import dict_has_ordered_keys, filter_none, force_real_str
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/drf_yasg/utils.py", line 10, in <module>
    from rest_framework import serializers, status
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/rest_framework/compat.py", line 25, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/home/olivier/anaconda3/envs/ml/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception
Starting new HTTPS connection (1): o227124.ingest.sentry.io:443
https://o227124.ingest.sentry.io:443 "POST /api/5820521/store/ HTTP/1.1" 200 41

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Label Studio Version : label_studio-1.7.2-py3-none-any.whl
  • Conda : 23.1.0
  • Kernel : 5.19.0-35-generic

Additional context
My conda environnment start with python 3.10.6 and after the first command the python version become 3.11

@farioas
Copy link
Member

farioas commented Mar 29, 2023

I've repeated all your steps and found that conda forces to install psycopg2-binary==2.9.1 instead of our dependency psycopg2==2.9.5 (https://github.com/heartexlabs/label-studio/blob/ls-release/1.7.2/deploy/requirements.txt#L50):

...
Collecting psycopg2-binary==2.9.1
  Using cached psycopg2-binary-2.9.1.tar.gz (380 kB)
  Preparing metadata (setup.py) ... done
...
Building wheels for collected packages: psycopg2-binary
  Building wheel for psycopg2-binary (setup.py) ... done
  Created wheel for psycopg2-binary: filename=psycopg2_binary-2.9.1-cp311-cp311-linux_x86_64.whl size=168148 sha256=d9149cdb8a5ebab1198e6e0a6f0ef7ea32f82ae56ff50a76b284995b50696332
  Stored in directory: /root/.cache/pip/wheels/f1/1a/c9/bfe23827cc8df9048a813d15686451b15427725865bcfe7aed
Successfully built psycopg2-binary

But I found a workaround:

conda install psycopg2

This will install psycopg2-2.9.3 which will unblock the startup of label-studio

@farioas farioas changed the title Unable to install label-studio with pip Unable to install label-studio with anaconda Mar 29, 2023
@EnlNovius
Copy link

I encountered the same problem recently and got around it by installing libpq in conda before installing label-studio.

conda create -n label-studio python=3.9
conda activate label-studio
conda install -c anaconda libpq
pip install -U label-studio

https://stackoverflow.com/questions/73580495/how-shoud-i-fix-error-with-pip-install-psycopg2-2-7

@farioas
Copy link
Member

farioas commented Apr 5, 2023

This issue will be fixed in 1.7.3 release coming soon.

@farioas farioas closed this as completed Apr 5, 2023
@makseq makseq added problem bug or something isn't working installation labels Apr 6, 2023
@makseq
Copy link
Member

makseq commented Apr 6, 2023

Another thing you can try:

conda install psycopg2

@17bryen
Copy link

17bryen commented May 10, 2023

For anyone else still getting this error, I had to force reinstall in order to get the correct version of psycopg2-binary:
pip install psycopg2-binary --force-reinstall

@robb666
Copy link

robb666 commented Jun 9, 2023

I'm experiencing this problem with pip.

When pip install psycopg2-binary --force-reinstall I get:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
label-studio 1.7.1 requires psycopg2-binary==2.9.1, but you have psycopg2-binary 2.9.6 which is incompatible.

And I am back to;

╔════════════════╗

║ Update available 1.7.1 → 1.8.0
║ Run pip install -U label-studio

╚════════════════╝

@hxuaj
Copy link

hxuaj commented Jul 3, 2023

Hi I've encountered the same problem by following the official install guide with anaconda.
After reinstall psycopg2, the problem was still there. Then I found that the root cause is conda install Python3.11 automatically, while label-studio is only supported under Python3.9. So the problem is solved by install Python3.9 first, then install label-studio 1.8.

hxuaj added a commit to hxuaj/label-studio that referenced this issue Jul 3, 2023
Update the installation guide with anaconda, specified the Python version due to psycopg2 problem mentioned in HumanSignal#3907.
@khadijakhaldi
Copy link

@hxuaj how to install label-studio 1.8 ? is the default version ? in this case should we run this: conda install psycopg2 # required for LS 1.7.2 only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation problem bug or something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants