Touching Python for the first time in about a year. Working in Ubuntu.
Having an issue installing, locating, using modules. Previously when working in Python, I could have sworn if there was a missing module imported it would download automatically. I could be wrong.
Nonetheless, trying to install a module via pip3 and I get a syntax error.
edit
Although I just tried from the terminal pip3 install pandas and it was working for me. . . Reviewing your code not sure why you called python and then a path to pip?
wwed@wwed-Z590-AORUS-MASTER:~$ python3 -m pip install pandas
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Thats interesting and it worked although I’ve never or never recall using venv before. I wonder if I adulterated by system by installing multiple versions.
Probably, but environments should separate it and make it so that you don’t have to specify which python and the pip package location. What likely happened is you ran pip3 install pandas so it tried using the system’s python
Also you don’t need pandas.py. Pip is a python package manager similar to apt. You don’t need to include the file extension
wwed@wwed-Z590-AORUS-MASTER:~$ sudo python3.12 -m easy_install pip
sudo: python3.12: command not found
wwed@wwed-Z590-AORUS-MASTER:~$ sudo python3.8 -m easy_install pip
sudo: python3.8: command not found
wwed@wwed-Z590-AORUS-MASTER:~$ sudo python3 -m easy_install pip
/usr/bin/python3: No module named easy_install
I am starting to remember now that in my old projects it was just getting to be able to work in python was the long part and scripting was the easy part
If you don’t mind IDE’s, consider PyCharm or VSCodium. They have some dependency management type stuff built in, including installing and managing python for you.