I’m getting this error in my virtual env on Visual Studio Code.
(venv_x86) aryandaga@Aryans-MacBook-Pro-2 AI-DJ % allin1 data/audio_samples/ATMOSPHERE - FISHER x KITA ALEXANDER.mp3
=> Found 0 tracks already analyzed and 1 tracks to analyze.
=> Found 0 tracks already demixed, 1 to demix.
Downloading: "https://dl.fbaipublicfiles.com/demucs/hybrid_transformer/955717e8-8726e21a.th" to /Users/aryandaga/.cache/torch/hub/checkpoints/955717e8-8726e21a.th
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 975, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1075, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/separate.py", line 219, in <module>
main()
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/separate.py", line 133, in main
model = get_model_from_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/pretrained.py", line 96, in get_model_from_args
return get_model(name=args.name, repo=args.repo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/pretrained.py", line 76, in get_model
model = any_repo.get_model(name)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/repo.py", line 148, in get_model
return self.bag_repo.get_model(name_or_sig)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/repo.py", line 130, in get_model
models = [self.model_repo.get_model(sig) for sig in signatures]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/repo.py", line 130, in <listcomp>
models = [self.model_repo.get_model(sig) for sig in signatures]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/demucs/repo.py", line 65, in get_model
pkg = torch.hub.load_state_dict_from_url(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/torch/hub.py", line 766, in load_state_dict_from_url
download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/torch/hub.py", line 620, in download_url_to_file
u = urlopen(req)
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
Traceback (most recent call last):
File "/Users/aryandaga/AI-DJ/venv_x86/bin/allin1", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/allin1/cli.py", line 53, in main
analyze(
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/allin1/analyze.py", line 118, in analyze
demix_paths = demix(todo_paths, demix_dir, device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/aryandaga/AI-DJ/venv_x86/lib/python3.11/site-packages/allin1/demix.py", line 30, in demix
subprocess.run(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 569, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Users/aryandaga/AI-DJ/venv_x86/bin/python3.11', '-m', 'demucs.separate', '--out', '/Users/aryandaga/AI-DJ/demix', '--name', 'htdemucs', '--device', 'cpu', '/Users/aryandaga/AI-DJ/data/audio_samples/ATMOSPHERE - FISHER x KITA ALEXANDER.mp3']' returned non-zero exit status 1.
(venv_x86) aryandaga@Aryans-MacBook-Pro-2 AI-DJ % pip install --upgrade certifi
Requirement already satisfied: certifi in ./venv_x86/lib/python3.11/site-packages (2024.7.4)
And I checked online and found one of the ways is to go to open Application/Python3.11/Install Certificates.commmand
When doing that I’m getting this in my terminal. I’ve been trying to figure out how to resolve this issue but I’m unable to find any solution.
/Applications/Python 3.11/Install Certificates.command ; exit;
-- pip install --upgrade certifi
Collecting certifi
Using cached certifi-2024.7.4-py3-none-any.whl (162 kB)
Installing collected packages: certifi
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi'
Consider using the `--user` option or check the permissions.
[notice] A new release of pip available: 22.3 -> 24.2
[notice] To update, run: pip3 install --upgrade pip
Traceback (most recent call last):
File "<stdin>", line 44, in <module>
File "<stdin>", line 24, in main
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Here are more details that might be needed which I’m providing. This is from my local terminal.
aryandaga@Aryans-MacBook-Pro-2 ~ % python3 --version
Python 3.11.0
aryandaga@Aryans-MacBook-Pro-2 ~ % pip --version
pip 24.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
aryandaga@Aryans-MacBook-Pro-2 ~ % pip install --upgrade certifi
Requirement already satisfied: certifi in /usr/local/lib/python3.10/site-packages (2024.7.4)
2
Answers
I have fixed the issue. Here are the in-detailed steps by chat gpt explaining the issue and fixing it incase anyone runs into the same issue in the future.
Understanding the SSL Certificate Issue
SSL Certificates are crucial for establishing secure connections over the internet. They help in verifying the identity of servers and encrypting the communication. Python and other software use these certificates to ensure secure connections. If Python or a tool like allin1 can’t find or validate these certificates, it can’t establish secure connections.
The error message you saw (SSL: CERTIFICATE_VERIFY_FAILED) indicates that the tool (allin1 in this case) tried to establish a secure connection but failed because it couldn’t verify the SSL certificate.
a) Default Paths: The OpenSSL library (which Python uses) expects certificates to be in specific locations. In your case, it’s looking for certificates at /usr/local/etc/openssl@3/certs, but it’s not finding any there. b) Existing Certificates: Your system has certificates at /usr/local/etc/ca-certificates/cert.pem, and the cert.pem file there seems to be a valid CA certificate.
Steps to Fix
Ensure the directory exists where OpenSSL expects certificates: /usr/local/etc/openssl@3/certs.
Copy your CA certificates to this directory so OpenSSL can use them.
Create symbolic links in the certs directory to make the certificates recognizable by OpenSSL.
Summary Problem: allin1 couldn’t verify SSL certificates because it couldn’t find them at the expected path. Solution: Ensure the certificates are in the directory OpenSSL expects, or adjust Python’s environment to point to the correct certificate paths. Why Necessary: This ensures that all tools and libraries find the certificates they need to establish secure connections.
I hope this helps have a nice day.
There is a mismatch between your python and pip – 3.11 vs 3.10. Try installing
certifi
withpython3.11 -m pip install --upgrade ceritifi
. You can also run the Install Certificates command with sudo, although installing Python packages as a superuser is generally not recommended