Search code examples
pythoninstallationterminalpippackage

I cannot install any python package


I cannot install the package in projects that were created anywhere other than the PyCharmProjects folder. I tried to create projects on the desktop both through PyCharm and without it, the result is the same just endless loading. But if you create in the PyCharmProjects folder, then no problem.

P.s in all projects had a virtual environment (venv)

Example: pip install aiogram

ERROR: Operation cancelled by user

Traceback (most recent call last):
File "C:\Program Files\Python310\lib\tempfile.py", line 252, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'c:\\users\\ali\\appdata\\local\\pip\\cache\\http\\a\\1\\9\\5\\3\\a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a4mlo_4p9.tmp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\Scripts\pip.exe\__main__.py", line 7, in <module>       
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\main.py", line 70, in main
return command.main(cmd_args)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 98, in main
return self._main(args)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 214, in _main
self.handle_pip_version_check(options)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 147, in handle_pip_version_check
pip_self_version_check(session, options)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\self_outdated_check.py", line 152, in pip_self_version_check
best_candidate = finder.find_best_candidate("pip").best_candidate
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 851, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 798, in find_all_candidates
page_candidates = list(page_candidates_it)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\package_finder.py", line 758, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 490, in fetch_page
return _get_html_page(location, session=self.session)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 400, in _get_html_page
resp = _get_html_response(url, session=session)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\index\collector.py", line 115, in _get_html_response
resp = session.get(
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\network\session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\requests\adapters.py", line 533, in send
return self.build_response(request, resp)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 79, in build_response
cached_response = self.controller.update_cached_response(
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 374, in update_cached_response
self.cache.set(cache_url, self.serializer.dumps(request, cached_response))
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\network\cache.py", line 61, in set
with adjacent_tmp_file(path) as f:
File "C:\Program Files\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\Ali\Coding\Python\Zapparil\venv\lib\site-packages\pip\_internal\utils\filesystem.py", line 82, in adjacent_tmp_file
with NamedTemporaryFile(
File "C:\Program Files\Python310\lib\tempfile.py", line 549, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "C:\Program Files\Python310\lib\tempfile.py", line 252, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)

KeyboardInterrupt


Solution

  • On a Windows machine, there are a lot of reasons that a pip install can fail (Windows doesn't allow some programs to access to some files). You may have to give admin permissions to the terminal you are using.