Score:0

Why psycopg2 is not able to install in a virtual environment?

cf flag

Just installed ubuntu20.04.

Installed python3.10 by

sudo apt install python3.10

Then created virtualenv

pip install virtualenv
virtualenv -p python3.10 venv

Now I'm trying to install requirement for my project. The only one issue I got was with distutils. But I typed smth like

sudo apt install python3.10-distutils

And it's gone. I have requirements list like

  • amqp==5.0.6
  • asgiref==3.4.1
  • billiard==3.6.4.0
  • celery==5.1.2
  • certifi==2021.5.30
  • charset-normalizer==2.0.6
  • click==7.1.2
  • click-didyoumean==0.0.3
  • click-plugins==1.1.1
  • click-repl==0.2.0
  • dj-database-url==0.5.0
  • Django==3.2.7
  • django-celery-beat==2.2.1
  • django-celery-results==2.2.0
  • django-heroku==0.3.1
  • django-redis==5.0.0
  • django-timezone-field==4.2.1
  • gunicorn==20.1.0
  • idna==3.2
  • kombu==5.1.0
  • prompt-toolkit==3.0.20
  • psycopg2==2.9.1
  • python-crontab==2.5.1
  • python-dateutil==2.8.2
  • python-dotenv==0.19.0
  • pytz==2021.1
  • redis==3.5.3
  • requests==2.26.0
  • six==1.16.0
  • sqlparse==0.4.2
  • urllib3==1.26.6
  • vine==5.0.0
  • wcwidth==0.2.5
  • whitenoise==5.3.0

They all installed except of psycopg2. When I type (in activated virtualenv)

pip install psycopg2==2.9.1

And getting this error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

David avatar
cn flag
What are the actual errors and commands you see and type. This long list of file names means nothing. The whole question could use some clarity.
илья авраменко avatar
cf flag
@David I putted this list to show that other modules are frelly installed. The only one issue is with the psycopg2. When i type pip install psycopg2 I'm getting mentioned error: error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
cn flag
"x86_64-linux-gnu-gcc" would have me believe you are missing headers. is `sudo apt install python3.10-dev` a fix?
илья авраменко avatar
cf flag
@Rinzwind Nope. I saw this site and typed all mentioned commands. https://linuxnetmag.com/x86_64-linux-gnu-gcc-failed/
Score:1
mx flag

Try

pip install psycopg2-binary

This will not require any C code compilation

Score:1
cf flag

Solved with

sudo apt-get install libpq-dev
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.