Encountered error while trying to install package psycopg2

my requirements/local.txt cat requirements/base.txt |grep psycopg2 # like Pillow and psycopg2 psycopg2==2.7.3.2 #psycopg2==2.7.5 pip install psycopg2 error messages pip install psycopg2==2.7.3.2 Co...

my requirements/local.txt

cat requirements/base.txt |grep psycopg2
# like Pillow and psycopg2
psycopg2==2.7.3.2
#psycopg2==2.7.5

pip install psycopg2 error messages

pip install psycopg2==2.7.3.2
Collecting psycopg2==2.7.3.2
  Using cached psycopg2-2.7.3.2.tar.gz (425 kB)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/administrator/D/neo/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-c1y2hug1
       cwd: /tmp/pip-install-toh63sp5/psycopg2/
  Complete output (62 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/psycopg1.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
  creating build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_green.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_connection.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/testconfig.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_lobject.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_sql.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_async_keyword.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_cursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/testutils.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_notify.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_replication.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_cancel.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_quote.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_dates.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_copy.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_async.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_transaction.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_with.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_module.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
  Skipping optional fixer: buffer
  Skipping optional fixer: idioms
  Skipping optional fixer: set_literal
  Skipping optional fixer: ws_comma
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/psycopg
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.2 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=120200 -DHAVE_LO64=1 -I/home/administrator/D/neo/.ve/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
  psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
  psycopg/psycopgmodule.c:685:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
    685 |     while (interp->next)
        |                  ^~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
    Running setup.py install for psycopg2 ... error
    ERROR: Command errored out with exit status 1:
     command: /home/administrator/D/neo/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e0e08klq/install-record.txt --single-version-externally-managed --compile --install-headers /home/administrator/D/neo/.ve/include/site/python3.8/psycopg2
         cwd: /tmp/pip-install-toh63sp5/psycopg2/
    Complete output (62 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/psycopg1.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
    copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
    creating build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_green.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_connection.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/testconfig.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_sql.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_async_keyword.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/testutils.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_notify.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_replication.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_quote.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_dates.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_copy.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_async.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_with.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_module.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/psycopg
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.2 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=120200 -DHAVE_LO64=1 -I/home/administrator/D/neo/.ve/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
    psycopg/psycopgmodule.c:685:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
      685 |     while (interp->next)
          |                  ^~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/administrator/D/neo/.ve/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-toh63sp5/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e0e08klq/install-record.txt --single-version-externally-managed --compile --install-headers /home/administrator/D/neo/.ve/include/site/python3.8/psycopg2 Check the logs for full command output.

I could install with psycopg2 version >= 2.8.0
but with 2.7.x , pip install will generate those error messages.

is that mean psycopg2 2.7.x can not work with python 3.8 in ubuntu 20.04 ?

Содержание

  1. Package failed to install error while installing package
  2. Check if your Python version is supported by the package #
  3. Create a virtual environment #
  4. Try running pip install in verbose mode #
  5. Conclusion #
  6. Encountered error while trying to install package
  7. Error while installing packages
  8. Как исправить ошибку Encountered error while trying to install package
  9. Что это за ошибка
  10. Как исправить
  11. How To Solve Error: legacy-install-failure?
  12. Solve error: legacy-install-failure For Gensim
  13. Solve error: legacy-install-failure In Pandas
  14. Solve error: legacy-install-failure For Basemap
  15. Solving For Windows Operating System
  16. Solving For MAC Operating System
  17. Solving For Google Colab
  18. Solve error: legacy-install-failure For MySQL
  19. Solve error: legacy-install-failure For Wxpython
  20. Solve error: legacy-install-failure For Psycopg2-binary
  21. Solve Error legacy-install-failure For Cffi
  22. Solve error: legacy-install-failure For Dlib
  23. Solve Error legacy-install-failure For Fbprophet
  24. Solve error: legacy-install-failure For Horovod
  25. FAQs on Error: legacy-install-failure
  26. Conclusion

Package failed to install error while installing package

Once you open the file, open your shell in the directory where the file is located (e.g. C:UsersExampleDownloads ) and install it using pip :

  1. Open the directory that contains the file in Explorer.
  2. Press Shift and right-click in Explorer.
  1. Click on «Open PowerShell window here».
  2. Run the following command.

Make sure to specify the name of the .whl file correctly as your Python version and the name of the package will likely be different.

If that didn’t help and your error message contains something like: «error: Microsoft Visual C++ 14.0 or greater is required. Get it with «Microsoft C++ Build Tools»: https://visualstudio.microsoft.com/visual-cpp-build-tools/», download Microsoft Build tools and check the «Desktop development with C++ checkbox when installing.

Check if your Python version is supported by the package #

The «error: legacy-install-failure» is sometimes caused when the package you are trying to install doesn’t have available wheels for your version of Python.

You can check your Python version with the python —version command.

You can check if a package has wheels available for a specific Python version in the Download files section of the package’s pypi page.

If the .whl files are not available for your version of Python, you can download an older version.

You can download a specific Python version that is supported by the package if the package doesn’t support the latest Python version.

Different versions are available in the «Looking for a specific release» table.

Make sure to tick the following options if you get prompted:

  • Install launcher for all users (recommended)
  • Add Python to PATH (this adds Python to your PATH environment variable)

Create a virtual environment #

To solve the «error: legacy-install-failure»:

  1. Create a virtual environment.
  2. Activate the virtual environment.
  3. Run the pip install command with the virtual environment active.

If the python3 -m venv venv command doesn’t work, try the following 2 commands:

  • python -m venv venv
  • py -m venv venv

Make sure to use the correct command to activate your virtual environment depending on your operating system and your shell.

Your virtual environment will use the version of Python that was used to create it.

Try running pip install in verbose mode #

If none of the suggestions helped, try running the pip install command in verbose mode.

The -v option stands for verbose mode and can be used up to 3 times.

When the pip install command is run in verbose mode, the command shows more output and how the error occurred.

Conclusion #

To solve the «Error: legacy-install-failure»:

  1. Upgrade your versions of pip , setuptools and wheel before running pip install .
  2. Check if your Python version is supported by the package.
  3. On Windows, download and install the package from unofficial binaries.
  4. Try to install the package with the —pre option.

Источник

Encountered error while trying to install package

28.07.2022 698 Просмотры

Я хочу установить пакет gensim python через pip install gensim.

Но возникает эта ошибка, и я не знаю, что мне делать, чтобы решить ее.

Если вам не удалось установить плагины,
вы можете скачать его из других репозиториев, например, из этого: репозиторий зависит от версии python и системы.

например: для windows 11(x64) и python 3.10 вы должны взять этот файл: gensim-4.1.2-cp310-cp310-win_amd64.whl

Error while installing packages

Я использую Ubuntu 12.04. Я столкнулся с ошибкой при установке любого пакета с помощью apt-get. Я пробовал шаги, приведенные на различных форумах, но не смог решить проблему. Например, если я устанавливаю kcachegrind, код ошибки следующий:

[Я заменил http:// на http// только для того, чтобы избежать ссылок при размещении вопроса. Поэтому, пожалуйста, читайте http// как http:// в сегментах кода].

Попробуйте выполнить следующие команды,

sudo dpkg -P mysql-client-5.1
sudo apt-get install -f

В ошибке написано что для компиляции пакета нужно установить Microsoft C++ Build Tools версии 14.2 или выше, а также приведена ссылка где их можно скачать: https://visualstudio.microsoft.com/visual-cpp-build-tools/.

Hi,
pip install sentencepiece fails,
This is the log I get:

pip install sentencepiece
7.4.0
Collecting sentencepiece
Using cached https://files.pythonhosted.org/packages/fd/45/6d0eb609d5cd81df094aab71a867b2ab6b315ffd592e78fb94a625c4d6aa/sentencepiece-0.1.3.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: /bin/sh: 1: pkg-config: not found
Failed to find sentencepiece pkgconfig
—————————————-
ERROR: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-463tj_x8/sentencepiece/

Same here, only happens on Python 3.7.4 for me, works on Python 3.6. Observed on Ubuntu 16.04.4

Источник

Как исправить ошибку Encountered error while trying to install package

Мир программирования полон испытаний, которые нередко пугают новичков. Вне зависимости от своего стажа, программисты сталкиваются с различными багами, глюками, сбоями и прочими ошибками, на исправление которых может уйти как несколько минут, так и целый день. Например, Python-разработчики часто сталкиваются с ошибкой «Encountered error while trying to install package». Расскажем о том, что это за ошибка и что делать при ее возникновении.

Что это за ошибка

Вообще, чаще всего пользователи читают только половину вывода интерпретатора (а порой и вовсе только ее название), не обращая внимания на ее описание и результаты трассировки, которые указаны выше. Для того чтобы разобраться в проблеме, попробуем дословно перевести ее на русский.

«Обнаружена ошибка при попытке установить пакет» – именно так звучит ошибка. Она возникает только в тех случаях, когда пользователь хочет установить сторонний пакет Python с помощью пакетного менеджера Pip. Чаще всего проблема связана с нехваткой необходимого модуля или пакета. Название отсутствующего компонента указывается в результатах трассировки.

Как исправить

Многие устанавливаемые пакеты зависят от служебного компонента, который называется «Microsoft C++ Build Tools» (инструменты сборки Microsoft C++). В первую очередь попробуйте установить его. Алгоритм действий:

  • Нажмите на кнопку «Загрузить Build Tools».

  • Дождитесь завершения загрузки и запустите установщик.
  • Укажите путь для сохранения компонента.

  • Дождитесь завершения установки.

После этих махинаций снова попробуйте установить проблемный компонент. Если ничего не получилось, то значит проблема в нехватке другого компонента. Внимательно ознакомьтесь с выводом интерпретатора, в котором будет указан недостающий файл.

Источник

How To Solve Error: legacy-install-failure?

Python provides you with a package installer called ‘pip.’ ‘Pip’ allows you to write a line of code to install packages and manage them. Although sometimes, when you are installing some packages, you might get an ‘error: legacy-install-failure.’ For example, if you are trying to install the gensim package in python. To know more about ‘pip’ check out this post.

Solving ‘ Error: legacy-install-failure’

In this article, we will discuss how we can solve this error.

Solve error: legacy-install-failure For Gensim

Pip is a package installer and manager, and the wheel is a way that pip prefers to install packages because the wheel allows fast and efficient installations and are smaller in comparison to eggs. Hence upgrading wheels might also solve the problem of ‘error: legacy-install-failure.’ The setuptools enhance the over-installation by enhancing the python standard library distribution utilities. Therefore if you update these modules, it might solve your error because this error can also arise if one of these modules is not up-to-date. Let us see how we can upgrade these modules.

  • First, update your pip installer as shown below.
  • Then upgrade your wheel by using:
  • Then finally upgrade the setuptools.
  • And then again try to install the package which was throwing error in the first place.

Solve error: legacy-install-failure In Pandas

Pandas is an open-source library in python which allows users to perform high-level data manipulation. It is one of the most important libraries in python in the sense of data structure programming and data analysis because it provides flexible, fast and expressive data structures. However, sometimes when you try to install this library using pip, you can get an ‘error: legacy-install-failure,’ which can prevent us from using this very important library. Let us see how we can solve this error in python.

To solve this problem, you need to install ‘pipwin’ because it may happen that the ‘pandas’ wheel might not support the python version you are working on; therefore, first, install ‘pipwin’.

And further, when you install ‘pipwin,’ install ‘pandas’ using ‘pipwin.’

This should probably solve the ‘error: legacy-install-failure’ and allow you to install the pandas library and use it.

Solve error: legacy-install-failure For Basemap

Basemap is a tool in python that provides you to create maps in a very easy and simple way. It is an extension of the ‘ matplotlib ‘ library; therefore, it contains all the features for carrying out data visualization. It further adds geographical projections and some other additional data sets in order to enable plotting coastlines, countries, states, boundaries and etc., directly from the library. Similarly, when you try to install this library through ‘pip,’ you might face a Solve ‘ error: legacy-install-failure’. We will discuss how we can solve this error for the basemap library.

Solving For Windows Operating System

If you are using Windows operating system and encounter this error you need to follow some steps. The steps are as given below:

gohlke/pythonlibs/#basemap

  • You will be directed to the file directory. If you’re using python 3.10.x, download the file named ‘basemap‑1.3.2‑cp310‑cp310‑win_amd64.whl
  • Now go to this wheel file and run the following command:
  • Doing this should solve the ‘error: legacy-install-failure’ error.

    Solving For MAC Operating System

    If you are using MAC Operating System and encounter this error, you need to follow some steps. The steps are as given below:

    • First, make sure you install all the packages as shown below:
    • Then you have to add GEOS_DIR = “/ user / local / Cellar / geos / 3.10.2 /” to your .bash profile and reload it via: source

    /.bash_profile. You can do that by :

    • Further, go to the basemap directory from the path: basemap/packages/ basemap. And finally, run the install code from that directory.

    This should solve the ‘error: legacy-install-failure’ error.

    Solving For Google Colab

    To solve this error in google colab, you need to run the commands given below, and doing that should solve the ‘error: legacy-install-failure’ error.

    Solve error: legacy-install-failure For MySQL

    MySQL provides services for handling and managing databases. When you connect your python application to an active server, you can manage all your database using MySQL. Although when installing using an ‘Error: legacy-install-failure’ error might occur. It can display something like this.

    To solve this following error, you will need to follow the steps given below:

    • First, run the commands given below
    • Further, make some changes in the settings file if you are using some framework like Django or any other. To make this change run these commands.

    Further, install all other dependencies in the env/lib/python3.8/site-packages/django/db/backends/mysql/base.py directory. These dependencies can be installed like:

    • Now try to install MySQL again, as following these steps should solve the error.

    Solve error: legacy-install-failure For Wxpython

    Wxpython is a cross-platform Graphical User Interface toolkit for python language. It enables the users to program independent and robust code, which provides a very high graphical user interface very easily and quite simply. This library, like many other libraries, is open source. Although sometimes, while installing ‘wxPython,’ you might face an ‘error: legacy-install-failure’ error.

    This error might occur because you might be using a python version that is not compatible with ‘wxPython.’ Therefore the easiest solution is to downgrade your python version to 3.9.13 because the last version of ‘wxPython’ came before python 3.10. There might be an alternative solution to this, but right now, this is the easiest solution.

    Solve error: legacy-install-failure For Psycopg2-binary

    To solve this error, you have to follow some steps. You can solve this problem by upgrading some packages.

    This code will upgrade some outdated packages and might solve the problem.

    Solve Error legacy-install-failure For Cffi

    When you are programming on Django, you might get an error while installing libraries. You can solve this error by the following code.

    Solve error: legacy-install-failure For Dlib

    You can also get an error while installing the ‘dlib’ library through pip. To solve this error, try to install the library from scratch by following the steps.

    • First, install ‘anaconda.’
    • Further activate the virtual environment through a command prompt.
    • Install ‘opencv’ using pip.
    • Install ‘dlib’ using pip.

    This will eventually solve your error.

    Solve Error legacy-install-failure For Fbprophet

    You can encounter an error while installing Facebook prophet using pip. This error occurs because you might not have installed dependencies for the wheel to be installed. You can solve this error by installing all the dependencies and then installing the ‘fbprophet’ using pip.

    Solve error: legacy-install-failure For Horovod

    When you are trying to install ‘horvord’ with ‘PyTorch,’ you might encounter an error of sort ‘error: legacy-install-failure’.

    This error occurs because an older version of ‘horovord’ than 0.24.0 is not compatible with PyTorch. Therefore you can solve this error by upgrading ‘horovord’ to newer versions.

    FAQs on Error: legacy-install-failure

    There are many ways you can solve this error, and we have discussed some of them in this article. You can follow those solutions to solve this error depending upon the library you want to install.

    You can upgrade setuptool with pip using the following command:
    pip install — upgrade setuptools

    You can pip install pandas from PyPI.

    Conclusion

    Finally conclude, we can say that we have discussed various methods in this article to solve the ‘error: legacy-install-failure’ error which occurs for different libraries and modules. You can use any of the methods according to your requirements and according to the library or modules, you want to install for your program.

    Источник

    • Печать

    Страницы: [1]   Вниз

    Тема: Проблемы с установкой psycopg2  (Прочитано 4082 раз)

    0 Пользователей и 1 Гость просматривают эту тему.

    Оффлайн
    dimanoga

    Всем привет! С linux  и python только знакомлюсь, нужна ваша помощь.
    Пробую

    pip install psycopg2
    В ответ:

    Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.n'
    Пытаюсь установить libpq-dev

    sudo apt-get install libpq-dev

    libpq-dev : Зависит: libpq5 (= 10.12-0ubuntu0.18.04.1) но 12.3-1.pgdg18.04+1 должен быть установлен
    Хотя версия последняя стоит.
    Удалял, потом ставил заново — реузльтата 0.
    Перерыл все форумы, но тоже не особо помогло.

    Что делать?


    Оффлайн
    archuser

    Что делать?

    У Вас Ubuntu 18.04 и следовательно libpq5 версии 10.12-0*. Вы же пытаетесь установить psycopg2 из альтернативного репозитория, что приводит к рассогласованности неудовлетворенных зависимостей, установленных из официальных репозиториев Ubuntu. Вывод: либо вручную разрешаете все зависимости, что может привести к неработоспособности как отдельных приложений, так и все системы в целом, либо устанавливаете штатный пакет psycopg2:

    sudo apt install python-psycopg2 #для python2
    sudo apt install python3-psycopg2 #для python3


    Оффлайн
    dimanoga

    sudo apt install python3-psycopg2 #для python3

    Установил для python3
    при запуске django

    python manage.py runserver

    learnPython/venv2/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 29, in <module>
        raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
    django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'


    Оффлайн
    archuser

    dimanoga, а чего Вы ждете от винегрета в Вашей системе? Вручную установили python версии 3.8, в то время как в Ubuntu 18.04 python штатно представлен версией 3.6.7. И потому установка ранее предложенного пакета python3-psycopg2 не дала результата. Я Вам предлагаю отказаться от самодеятельности и использоваться только пакеты из официально поддерживаемых репозиториев Вашего дистрибутива.


    Оффлайн
    dimanoga

    dimanoga, а чего Вы ждете от винегрета в Вашей системе? Вручную установили python версии 3.8, в то время как в Ubuntu 18.04 python штатно представлен версией 3.6.7. И потому установка ранее предложенного пакета python3-psycopg2 не дала результата. Я Вам предлагаю отказаться от самодеятельности и использоваться только пакеты из официально поддерживаемых репозиториев Вашего дистрибутива.

    Хорошо. Что сделать чтобы заработало.
    Откатить python до 3.6.7?


    Оффлайн
    archuser

    Откатить python до 3.6.7?

    Вы правильно поняли мой посыл.


    Оффлайн
    dimanoga


    • Печать

    Страницы: [1]   Вверх

    Понравилась статья? Поделить с друзьями:

    Читайте также:

  • Encountered error while generating package metadata see above for output
  • Encountered error while building for device
  • Encountered error during oauth token request
  • Encountered error during federation passive request
  • Encountered an improper argument ошибка как исправить

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии