Home>

When trying to install any library using the commandpip install [package name]writesDefaulting to user installation because normal site-packages is not writeable.The library itself is not installed inC: \ Program Files \ Python39 \ Lib \ site-packages(where python was installed) and a new folder is created instead% AppData% \ Roaming \ Python39 \ Lib \ site-packages.As a result, the installed libraries are not functioning correctly. How can I fix this error?

PyCharm refuses to import libraries, although it sees them:

P.S. The answers didn’t solve the problem.

I would try to install packages from the administrator. The impression is that the rights are not enough to put where everything now lies.

CrazyElf2021-12-29 07:10:45
  • Answer # 1

    Try checking the path of python itself in your IDE. If you do this procedure through the terminal of the IDE itself, chances are that this is the problem.

    Better go to the console and write the python command, see if you are using that version, or go to the python directory in the console and try pip install there.

    If none of the above helps, install the library as it turns out, and from that directory transfer the necessary library files to the python directory that your IDE uses.

    If you do pip install from the python directory, the library is still installed in% AppData% \ Roaming \ Python. I tried to drag the installed libraries files into the directory where python is installed. As a result, pip list correctly outputs these libraries, but PyCharm for some reason does not see them :(

    Gladius2021-12-28 20:12:51

    Now, for the sake of interest, I wrote pip list in the console in PyCharm itself. The absurdity is that it correctly shows all installed libraries, but when importing, it gives an error, as if they were not installed

    Gladius2021-12-28 20:14:08

    Have you checked the python path in pycharm? If yes then try another IDE, mb the problem is in it

    vsi-2021-12-28 20:26:33

    And in general, in pyCharm, after all, you can install the library without pip install, try this

    vsi-2021-12-28 20:27:36
  • Answer # 2

    Try checking the path of python itself in your IDE. If you do this procedure through the terminal of the IDE itself, chances are that this is the problem.

    Better go to the console and write the python command, see if you are using that version, or go to the python directory in the console and try pip install there.

    If none of the above helps, install the library as it turns out, and from that directory transfer the necessary library files to the python directory that your IDE uses.

    If you do pip install from the python directory, the library is still installed in% AppData% \ Roaming \ Python. I tried to drag the installed libraries files into the directory where python is installed. As a result, pip list correctly outputs these libraries, but PyCharm for some reason does not see them :(

    Gladius2021-12-28 20:12:51

    Now, for the sake of interest, I wrote pip list in the console in PyCharm itself. The absurdity is that it correctly shows all installed libraries, but when importing, it gives an error, as if they were not installed

    Gladius2021-12-28 20:14:08

    Have you checked the python path in pycharm? If yes then try another IDE, mb the problem is in it

    vsi-2021-12-28 20:26:33

    And in general, in pyCharm, after all, you can install the library without pip install, try this

    vsi-2021-12-28 20:27:36
  • Answer # 3

    python -m pip install --upgrade pip

    In the terminal, type, update.

    It was also today.

    Your answer can be improved with more information. Please click edit to add details such as quotes or documentation so others can confirm your answer is correct. You can find more information on how to write good answers in the Help.

    Дух сообщества2021-12-28 20:32:04

    When upgrading, pip is installed again in the% AppData% \ Roaming \ Python39 \ Lib \ site-packages directory, and the original pip remains in the Program Files

    Gladius2021-12-28 20:40:53
  • Answer # 4

    python -m pip install --upgrade pip

    In the terminal, type, update.

    It was also today.

    Your answer can be improved with more information. Please click edit to add details such as quotes or documentation so others can confirm your answer is correct. You can find more information on how to write good answers in the Help.

    Дух сообщества2021-12-28 20:32:04

    When upgrading, pip is installed again in the% AppData% \ Roaming \ Python39 \ Lib \ site-packages directory, and the original pip remains in the Program Files

    Gladius2021-12-28 20:40:53