Jupyter Lab not oppening - The process is being used by another process - python

Hey guys I am trying to open Jupyter Lab and install some packages from the command line and I get the following error, it looks like python is being used by other process.
Traceback (most recent call last):
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 92, in _tempfile
os.write(fd, reader())
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\Scripts\jupyter-lab.exe\__main__.py", line 4, in <module>
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab\labapp.py", line 15, in <module>
from jupyterlab_server import (
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\__init__.py", line 5, in <module>
from .app import LabServerApp
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\app.py", line 10, in <module>
from .handlers import LabConfig, add_handlers
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\handlers.py", line 18, in <module>
from .listings_handler import ListingsHandler, fetch_listings
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\jupyterlab_server\listings_handler.py", line 8, in <module>
import requests
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 147, in <module>
from . import packages, utils
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 14, in <module>
from certifi import where
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 72, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\loque\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 98, in _tempfile
_os_remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\loque\\AppData\\Local\\Temp\\tmpfsz7k7d8'
How can I fix this?
I try Re-installing python and even installing other versions, not working still :(
I also deleted all the contents in the Temp folders and once i run the code it creates a new temp file that uses the process.

Related

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process [PYTHON]

I am trying to run a python program that was working fine until I performed the following 'pip install python-certifi-win32'. After that, the following error started popping up
Traceback (most recent call last):
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 92, in _tempfile
os.write(fd, reader())
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\duda_\Desktop\Swamp Hacks\swamp-hacks-project-backend\face2.py", line 6, in <module>
import pymongo
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\pymongo\__init__.py", line 92, in <module>
from pymongo.mongo_client import MongoClient
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\pymongo\mongo_client.py", line 59, in <module>
from pymongo import (
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\pymongo\uri_parser.py", line 32, in <module>
from pymongo.srv_resolver import _HAVE_DNSPYTHON, _SrvResolver
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\pymongo\srv_resolver.py", line 21, in <module>
from dns import resolver
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\dns\resolver.py", line 39, in <module>
import dns.query
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\dns\query.py", line 47, in <module>
import requests
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\__init__.py", line 147, in <module>
from . import packages, utils
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\utils.py", line 24, in <module>
from . import certs
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\certs.py", line 14, in <module>
from certifi import where
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\duda_\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 98, in _tempfile
_os_remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\duda_\\AppData\\Local\\Temp\\tmpxbh1yzqk'
I tried to uninstall it by doing pip uninstall python-certifi-win32, but it won't allow me to do that either.

Pip crashes after installing bitbucket repo to site-packages

So I have two VM machines running windows 10, and one one of them I get a funky error after installing one of our site-packages.
Some info:
Python version Python 3.10.2 with latests pip is installed, and I also have git 2.16.2.
The repository/python lib requires python 3.10+.
I run this command on my machine:
pip install --upgrade git+ssh://git#bitbucket.ccd2.com:7999/pyt/jira
it installed at normal, but when I then run pip list I get the following error:
$ pip list
Traceback (most recent call last):
File "C:\Programs\Python\Python3102\lib\importlib\_common.py", line 89, in _te mpfile
os.write(fd, reader())
File "C:\Programs\Python\Python3102\lib\importlib\abc.py", line 371, in read_b ytes
with self.open('rb') as strm:
File "C:\Programs\Python\Python3102\lib\importlib\_adapters.py", line 54, in o pen
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Programs\Python\Python3102\lib\runpy.py", line 196, in _run_module_as _main
return _run_code(code, main_globals, None,
File "C:\Programs\Python\Python3102\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Programs\Python\Python3102\Scripts\pip.exe\__main__.py", line 4, in < module>
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\main.p y", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\autoco mpletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\main_p arser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\cmdopt ions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\cli\parser .py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\configurat ion.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_internal\exceptions .py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_vendor\requests\__i nit__.py", line 135, in <module>
from . import utils
File "C:\Programs\Python\Python3102\lib\site-packages\pip\_vendor\requests\uti ls.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\decorators.py", li ne 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\Python3102\lib\site-packages\certifi_win32\wrapt_pip. py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\decorators.py", li ne 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\Python3102\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\Python3102\lib\site-packages\certifi_win32\wrapt_cert ifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Programs\Python\Python3102\lib\site-packages\certifi\core.py", line 3 7, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Programs\Python\Python3102\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Programs\Python\Python3102\lib\importlib\_common.py", line 95, in _te mpfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\77870\\AppData\\Local\\Temp\\2\\tmplh cnerdl'
I have no idea why it works on all other machines VM or my own PC, but this one VM machine has this problem.
I have reinstalled everything and tried different versions of python and git, but the same error occurs.
I think it looks like something is stuck maybe in the temp folder? or maybe I have an issue with something else that I don't know?
Because its in the Temp folder, maybe its just a leftover from a program. Try deleting it, but I would make a backup for in case things go wrong. However, because this is kinda risky, I would wait in case a better answer appears (I have too little rep to comment).
I corrected it by removing two *.pth files that were created when I had installed python-certifi-win32. This prevents python-certifi-win32 from loading when python is run.
The files are listed below, and were located here:
%LOCALAPPDATA%\Programs\Python\Python310\Lib\site-packages
Files:
python-certifi-win32-init.pth
distutils-precedence.pth
Had a machine where everything was running so made a pip freeze > req.txt file to check every version one by one, and then I just tried to update all the pip list --outdated packages, and when wrapt was updated the problem occurred. Downgraded the version to wrapt==1.13.3 which one of the other machines was running and now everything works.

certificate verify failed after deleting .pth files in site-packages

So when I download a package (site-packages), from bitbucket, using this command-line:
pip install --upgrade git+ssh://git#bitbucket.ggf.com:7999/pyt/jira, pip starts to not work.
I tried to debug and find the issue in this output:
Traceback (most recent call last):
File "C:\Programs\Python\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Programs\Python\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Programs\Python\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Programs\Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Programs\Python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Programs\Python\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Programs\Python\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Programs\Python\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Programs\Python\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Programs\Python\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Programs\Python\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 177, in _exec_module
notify_module_loaded(module)
File "C:\Programs\Python\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Programs\Python\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Programs\Python\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Programs\Python\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Programs\Python\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Programs\Python\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\a77870\\AppData\\Local\\Temp\\3\\tmpjivq2gz5'
I found out that if I removed these two files from site-packages then pip worked again, so for some reason these files make it stuck, but I don't know why?
python-certifi-win32-init.pth
distutils-precedence.pth
Now the problem with doing this is that the package which is installed jira, is an API that needs to connect over SSL, and I guess by deleting these .pth files that this creates some error now?
I get this output running a simple command, and its trying to connect to Jira:
Traceback (most recent call last):
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connectionpool.py", line 1040, in _validate_conn
conn.connect()
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "C:\Programs\Python\Python3102\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Programs\Python\Python3102\lib\ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "C:\Programs\Python\Python3102\lib\ssl.py", line 1070, in _create
self.do_handshake()
File "C:\Programs\Python\Python3102\lib\ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)
Any ideas on a way where I should delete these files?
By removing python-certifi-win32-init.pth the functionality of the library is effectively lost with doing so.
Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs . Drop-in replacing the library with pip-system-certs (PyPI link) solved all issues for me.

Pip is broken, gives PermissionError: [WinError 32]

I installed the python-certifi-win32 module (I'm so busy trying to fix this problem that I don't even remember why I originally installed it). Right after I installed it, though, I started getting this error when I run pip (extended error code below): PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
When I delete the file C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c, another file pops up in its place, just with a different random combination of letters and numbers, and the error says the new file name instead.
I have no idea how to fix it, my pip hasn't been working for days. I've looked through tens of pages of google results.
Full error code:
Traceback (most recent call last):
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\user1\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user1\\AppData\\Local\\Temp\\tmph93rz74c'
I ran into the same problem after installing python-certifi-win32. I installed this package in the hope to solve errors caused by the self-signed certificate used by our SSL Inspection infrastructure.
To bring pip back to a running state remove python-certifi-win32 from the installation folder:
Determine the installation path for pip packages (source):
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
Switch to the folder and delete the package's files:
del python-certifi-win32-init.pth
rmdir /s/q python_certifi_win32-1.6.dist-info
I could observe the same error pattern when upgrading from Python 3.9 to Python 3.10. Somehow python-certifi-win32 seems to be malfunctioning in certain scenarios then.
Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs . Drop-in replacing the library with pip-system-certs (PyPI link) solved all issues for me.
the only solution to this problem is to delete Python from control panel.Then completely delete the Python folder from the address below
windows:
C:\Users\user1\AppData\Local\Programs\python
and linux base:
/bin/python3

Not able to create or import existing conda project in Pycharm

I am trying to create or open existing conda project in PyCharm. In both cases I get this error:
TypeError: LoadLibrary() argument 1 must be str, not None
I have Anaconda3 package installed (conda 4.7.5) on my Windows machine. I was able to use it successfully from Anaconda Prompt (create and use environments, install packages and create project). But every time I try to create a project in PyCharm by selecting "File -> New Project -> Scientific -> New environment using Conda" with Python 3.6 I am getting the error above while the project is being created.
Alternatively, when I open existing conda project (from Anaconda Prompt) in PyCharm and then trying to select conda as interpreter I am getting exact same error.
I have been trying to solve this problem for 3 hours: reading forums, installing older versions, trying miniconda instead. Is that the problem with PyCharm?
Edit: Attached full stack trace.
Traceback (most recent call last):
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1043, in __call__
return func(*args, **kwargs)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 80, in do_call
module = import_module(relative_mod, __name__.rsplit('.', 1)[0])
File "C:\Users\Eduard\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 10, in <module>
from .install import install
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\install.py", line 19, in <module>
from ..core.index import calculate_channel_urls, get_index
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda_package_handling\api.py", line 3, in <module>
from libarchive.exception import ArchiveError as _LibarchiveArchiveError
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
from . import ffi
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\ffi.py", line 27, in <module>
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
File "C:\Users\Eduard\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Eduard\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Eduard\Anaconda3\Scripts\conda-script.py", line 12, in <module>
sys.exit(main())
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1335, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1046, in __call__
return self.handle_exception(exc_val, exc_tb)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1090, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1101, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\exceptions.py", line 1171, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\core\index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda_package_handling\api.py", line 7, in <module>
from .tarball import CondaTarBZ2 as _CondaTarBZ2
File "C:\Users\Eduard\Anaconda3\lib\site-packages\conda_package_handling\tarball.py", line 7, in <module>
import libarchive
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\__init__.py", line 1, in <module>
from .entry import ArchiveEntry
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\entry.py", line 6, in <module>
from . import ffi
File "C:\Users\Eduard\Anaconda3\lib\site-packages\libarchive\ffi.py", line 27, in <module>
libarchive = ctypes.cdll.LoadLibrary(libarchive_path)
File "C:\Users\Eduard\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Eduard\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None
I was getting the same issue while making a conda environment through command prompt. I added this in my environment variables. It helped in my case. Maybe it can help you as well
Your path to anaconda folder/Anaconda3/library/bin

Categories