xinjli / allosaurus

Allosaurus is a pretrained universal phone recognizer for more than 2000 languages
GNU General Public License v3.0
550 stars 86 forks source link

pip download #47

Open jacbrixey opened 2 years ago

jacbrixey commented 2 years ago

The pip download for allosaurus shows that it downloads successfully in the terminal, however allosaurus does not show up as a known module when I import it in my coding environment. What is the fix for this?

xinjli commented 2 years ago

that's a bit weird. can you verify that your pip is the exact python environment you are using? sometimes pip would install library into different python version.

jacbrixey commented 2 years ago

I did get the pip problem fixed, but now I have a new issue. I just tried to run the code for model.recognize and this was the output:

downloading model latest from: https://github.com/xinjli/allosaurus/releases/download/v1.0/latest.tar.gz to: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/pretrained please wait... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1342, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1255, in request Error: could not download the model self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 950, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/bin/download_model.py", line 25, in download_model resp = urlopen(url) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1385, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1345, 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:1122)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/linabrixey/PycharmProjects/cho_allosaurus/main_file.py", line 38, in main() File "/Users/linabrixey/PycharmProjects/cho_allosaurus/main_file.py", line 30, in main model = read_recognizer() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/app.py", line 17, in read_recognizer download_model('latest', alt_model_path) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/bin/download_model.py", line 32, in download_model (model_dir / model_name).rmdir() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1352, in rmdir self._accessor.rmdir(self) FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/pretrained/latest'

Process finished with exit code 1

xinjli commented 2 years ago

I do not know what happens here, but it looks your SSL connection might have some problem. Can you download that tar.gz using wget?

bulatte commented 1 year ago

I did get the pip problem fixed, but now I have a new issue. I just tried to run the code for model.recognize and this was the output:

downloading model latest from: https://github.com/xinjli/allosaurus/releases/download/v1.0/latest.tar.gz to: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/pretrained please wait... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1342, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1255, in request Error: could not download the model self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 950, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/bin/download_model.py", line 25, in download_model resp = urlopen(url) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1385, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1345, 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:1122)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/linabrixey/PycharmProjects/cho_allosaurus/main_file.py", line 38, in main() File "/Users/linabrixey/PycharmProjects/cho_allosaurus/main_file.py", line 30, in main model = read_recognizer() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/app.py", line 17, in read_recognizer download_model('latest', alt_model_path) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/bin/download_model.py", line 32, in download_model (model_dir / model_name).rmdir() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1352, in rmdir self._accessor.rmdir(self) FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/allosaurus/pretrained/latest'

Process finished with exit code 1

found a fix for this on stackoverflow (if you're using mac): https://stackoverflow.com/a/70495761/11080804