Subhash Dalmia
Subhash Dalmia

Reputation: 31

Issues while downloading on pydroid


import seaborn as sns 

sns.load_dataset('iris')
urllib.error.URLError: <urlopen error [Errno 110] Connection timed out>
import nltk 
nltk.download("wordnet")
[nltk_data] Error loading wordnet: <urlopen error [Errno 110]
[nltk_data]     Connection timed out>

I am getting these issues on pydroid for android. I am on personal mobile data. I cannot check on PC as that is not available. I have searched Google and stackoverflow.com. But nothing fits my situation. Kindly redirect me to link on stackoverflow.com where it matches or share workaround on pydroid if known!

I have tried installing inbuilt libraries within pydroid. IIEC has permissions/repository plug in. I have installed those too.

Python 3.9.7 (default, Oct  6 2021, 01:34:26) [GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import seaborn as sns
>>> sns.load_dataset('iris')

Inbuilt interpreter screenshot. This fails too.

import urllib.request 

request_url = urllib.request.urlopen('https://www.google.com/') 

if request_url.read() :
    print("works! ")
works!

[Program finished]

Trying to check if Internet permission is OK

Upvotes: 1

Views: 252

Answers (1)

Subham
Subham

Reputation: 411

import os as _os

from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize

from nltk import download as nltk_download
from nltk.data import path as nltk_path


nltk_path.append( _os.path.join('/storage/emulated/0/Machine Learning 2', 'temp'))


nltk_download(['stopwords', 'punkt'], download_dir=_os.path.join('/storage/emulated/0/Machine Learning 2', 'temp'), raise_on_error=True)

print(stopwords.words('english'))
print(word_tokenize("I am trying to find the download path 99."))

I installed pydroid on my mobile and recreated the issue. This worked for me.

source

Upvotes: 1

Related Questions