Peter
Peter

Reputation: 31

PyCharm cannot install packages

Short description: two computers in the same network, in the new one only those python scripts work that use native packages.

I have Pycharm in my old computer and it has worked fine. Now I got a new computer, installed the most recent version of Python and Pycharm, then opened one of my old projects. Both the old and the new computer are in the same network and the project is on a shared folder. So I did the following:

  1. File - Open - selected the project. Got a message that there is no interpreter
  2. Add local interpreter - selected the latest Python 311 exe. So location of the venv is the same as in the old computer (because it's a network folder) but Base interpreter is pointing to the C drive of my new computer.
  3. PyCharm creates a virtual environment and the code runs fine.
  4. I select another project which uses imported packages such as pandas. Again, same steps as above, add local interpreter. Venv is created.
  5. I go to File - Setting - Project and see that pip, setuptools and wheel are listed as Packages. If I double click one of these, I can re-install and get a note that installation is succesful, so nothing seems to be wrong in the connection (after all, both the old and the new computer are in the same network.
  6. I click the plus sign to add a new one, search pandas. Installation fails. Same thing if I try e.g. numpy.

Error message has lots of retrying, then "could not find the version that satisfies the requirement pandas (from versions: none", "not matching distribution found for pandas" (pip etc. have the latest versions).

After few hours of googling for solutions, I have tried the following:

  1. Complety uninstall and reinstall python and PyCharm. Checked that PATH was included in the installation.
  2. Tried launching pip command from shell
  3. Changed http proxy to auto-detect
  4. Typed 'import pandas' in PyCharm, then used the dropdown in the yellow bulb but there is no install option
  5. Started a new project in the new computer, tried to install pandas

All failed. I'm surprised that changing computers is this difficult. Please let me know if there are other options than staying in the old computer...

Upvotes: 1

Views: 1393

Answers (3)

David Ponzio
David Ponzio

Reputation: 1

I was having an issue installing packages and I could not install in PyCharm via any method - Terminal, Packages, or by clicking the lightbulb and trying to install.

However, I had recently changed the folders of all my files. I thought this was happening before, but I could be wrong. Regardless, I created a new project and copied the files into that new project, and I was able to install packages again.

Upvotes: 0

Peter
Peter

Reputation: 31

This took a while but here is what happened. Package installation did not work in project settings. Neither did it work when you select Python Packages tab at the bottom of the screen. The only thing that worked was to select the Terminal tab and manually install (pip install) there. We use a trusted repository but for other users, the easier package installation methods work. Not sure why they do not for me but at least there is this manual workaround.

Upvotes: 0

Guf
Guf

Reputation: 249

If you want to use venv in the network, please use SSH interpreter. Pycharm supports this method. Shared folders are not a recommended usage, For pycharm, it will consider this as a local file. If the file map is not downloaded locally, it will make an error.
Another way is to reinstall the project environment on the new computer through requirement.txt. Reasonable use of requirements.txt can effectively avoid many project bugs caused by environment migration or different dependent versions. Before installing some scientific module such as pandas, it is recommended to install visual studio build tools, such as gcc ...

Upvotes: 1

Related Questions