Installing python library's

luuk12345678905

New Member
Joined
Dec 7, 2022
Messages
14
Reaction score
2
Credits
114
I would like to make a webscraper in python but it won't even let me install a library, as you can see i typed the right command (i think its the right one :) ). but when i try to run my python it won't do it because it says that the library isn't installed.

Does anyone know what is wrong and a solution! (on pop_os! btw)
Screenshot from 2023-02-23 21-54-13.png
 


It's say you don't have permission to right there, so you either need to run it with sudo which is not recommended. You can install it in a virtualenv or as a normal user, the latter will do for your use case I would think.
Code:
pip3  install --user requests
 
According to that message both are already installed, what's the output of the following?
Code:
dpkg --list | egrep "requests|colorama"
 
luuk@pop-os:~$ dpkg --list | egrep "requests|colorama"
ii python3-colorama 0.4.4-1 all Cross-platform colored terminal text in Python - Python 3.x
ii python3-requests 2.25.1+dfsg-2 all elegant and simple HTTP library for Python3, built for human beings
ii python3-requests-file 1.5.1-1 all File transport adapter for Requests - Python 3.X

luuk@pop-os:~$
 
Those python modules you need are already installed on your system.
 
You need to select the correct python interpreter within VSCode.
 
Thanks it works now
i had to make a enviroment using:
python3 -m venv tutorial-env

then i had to install the library's after activating the enviroment using:
source tutorial-env/bin/activate

then chose it on visual studio code
Screenshot from 2023-02-23 21-54-13.png

As you can see
import requests
isn't underlined no more because it has it now!
Thank you very much
 
It seems that the library beautifulsoup4 is not installed in your Python environment.

To install the library, you can try running the following command in your terminal:

Copy code
pip install beautifulsoup4

If you have multiple Python versions installed on your system, you may need to specify the Python version explicitly. For example, if you want to install the library for Python 3.8, you can use the following command:

Copy code
python3.8 -m pip install beautifulsoup4

Once the library is installed, you should be able to import it in your Python code without any issues.
 

Members online


Top