How to build a wheel for nltk which includes wordnet (no download required)? - nltk

I am building a wheel for a package that uses word-forms which in turn uses nltk. When this package runs and imports word-forms that package then calls nltk.download("wordnet") which then croaks since it's running on a machine behind a firewall.
For example:
>>> from word_forms.word_forms import get_word_forms
[nltk_data] Error loading wordnet: <urlopen error [WinError 10060] A
[nltk_data] connection attempt failed because the connected party
[nltk_data] did not properly respond after a period of time, or
[nltk_data] established connection failed because connected host
[nltk_data] has failed to respond>
>>> import nltk
>>> nltk.download('popular')
[nltk_data] Error loading popular: <urlopen error [WinError 10060] A
[nltk_data] connection attempt failed because the connected party
[nltk_data] did not properly respond after a period of time, or
[nltk_data] established connection failed because connected host
[nltk_data] has failed to respond>
False
My idea is to build a wheel for nltk which already includes the wordnet dataset, assuming that this will bypass the nltk.download() call. Or maybe instead hack the word-forms code to somehow accomplish the same thing? I will build the wheel file on a machine that does have access to the internet and then copy it into the firewalled machine via SFTP.

I have fixed this by downloading the NLTK data on a separate machine then uploading it to the firewalled server via SFTP.
The download was performed using the command python -m nltk.downloader all.
Then in my Python code on the firewalled machine, I have added this:
os.environ['NLTK_DATA'] = 'H:/path/to/nltk_data'
Everything seems to work as advertised now.
(Thanks to the word_forms project for the helpful guidance on this issue.)

Related

NLTK download error (Host not responding)

this is the image (on the bottom u can find the error)
nltk.download()
after this command the above dialog box appeared but once i click download it says host not responding
Error downloading •abc' from < https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/abc.zip»:
curlopen error [WinError 100601 A connection attempt failed because the connected paty did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
i even tried to download individual package still not working
What should i need to do to download those file
i need this package for my project
thnx in advance

I have a problem importing a Bit compiler. How can I resolve the following error?

I'm working with 'Bit' to create reusable React components. I have created my 'Bit' account and followed tutorials on the web to log on to Bit from the terminal and I have initialized the Bit workspace. I am encountering the following error when importing the React compiler.
$ bit import bit.envs/compilers/react --compiler
fatal: unable to connect to a remote legacy SSH server from Harmony client
Any advice would be appreciated.
the compiler flag was removed in 0.0.537
harmony became default in 0.0.438 (so legacy was last default in 0.0.437)
but ... if you try to run this on 0.0.437 now, you're likely to get an error:
server responded with: "Please update your Bit client.
For additional information: https://docs.bit.dev/docs/installation#latest-version"
the best place to get bit.dev answers is their community Slack here: https://join.slack.com/t/bit-dev-community/shared_invite/zt-o2tim18y-UzwOCFdTafmFKEqm2tXE4w.

Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443 throws on uploading files to appcenter

I am working on sample tests for mobile application and to upload and run in AppCenter. I have tried with XamarinUITest and C# combination; test files uploaded and ran successfully. On trying test files with Appium, Java and Junit and tried to upload it in AppCenter throws Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443 in Terminal.
The snippet I am using to upload is:
appcenter test run appium --app "Appium/JunitiOS" --devices "Appium/iphone" --app-path pathToFile.ipa --test-series "test" --locale "en_US" --build-dir target/upload
Note: given corresponding file paths in the snippet.
and get the below in Terminal:
Preparing tests... done.
Validating arguments... done.
Creating new test run... done.
Validating application file... done.
Uploading files... failed.
Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443
Environment: darwin
App Upload Id: Appium/JunitiOS
Timestamp: 1554114371409
Operation: RunAppiumTestsCommand
Exit Code: 3
This error usually occurs when there's some sort of network issue (either WiFi dropping out, a corporate firewall or proxy or a DNS issue are likely culprits)
Things to try if the successful upload is running on a different machine or a different network
Check the failing upload over a different network
Make sure you can see the URLs and IPs from the machine you're running on
If that fails - reach out to support using the App Center portal and a support engineer will help you get up and running
Things to try if the successful upload is running on the same machine on the same network
Double check that the UITest tests are still working successfully
Check that you don't have any corporate firewall policies which could be blocking specific files
If that fails - reach out to support using the App Center portal and a support engineer will help you get up and running
I would also recommend running the command again using --debug - you should be able to see the API calls being sent and identify at which point the uploads are failing (and if it's the same point every time).

Broken MySql driver for PySide2 on Windows?

I've been forced to try to port to PySide2 from PySide because I'm developing code (on Windows 7) used inside Maya and Maya 2017 has moved to PySide2.
PySide2 ships with Maya but only comes with the driver to talk to sqlite DBs. So I need to tell Qt about a new DIR that contains the MySql driver, like this:
from PySide2 import QtWidgets
QtWidgets.QApplication.addLibraryPath("C:\temp\plugins")
This DIR contains a sub sqldrivers DIR which contains the driver. This works- when I call QtSql.QSqlDatabase.drivers() the new one is there so I've got the right driver and it's being picked up.
However when I create a new DB and call open:
db = QtSql.QSqlDatabase.addDatabase("QMYSQL3")
db.setDatabaseName("my_db")
db.setHostName("host")
db.setUserName("user")
db.setPassword("password")
db.open()
the open command returns False and the DB is not accessible. I call:
db.lastError()
and get:
# Result: <PySide2.QtSql.QSqlError("", "Driver not loaded", "Driver not loaded") at 0x0000000075410C08> #
NB: we successfully did the exact same thing with the previous PySide version.
Other threads mention similar things and it turned out to be missing the actual libmysql.dll, which is the actual MySql DLL and can result in the same error if missing. However I definitely have this on my system and it's definitely in the PATH. It's actually the same file that is being successfully picked up through PySide. But the PySide2 driver just wont open a connection to the DB.
I suspect maybe a dodgy driver but wondered if anyone has any experience with this or any advice?
I had the same error, but with postgres.
I solved by placing the libpq.dll connector library next to my script.py.
Then for mysql it would be libmysql.dll.
In my case I had to build the libpq.dll from the source of postgres 9.6
It seems that with PySide2 it is not necessary to use:
QtWidgets.QApplication.addLibraryPath ("C: \ path_to\ plugins")
using:
print (PySide2.QtCore.QLibraryInfo.location (PySide2.QtCore.QLibraryInfo.PluginsPath)), I could see that the path was correct.
a greeting

How can I check if a Perl module (DBD::mysql) is properly installed?

I am using XAMPP on Mac OS X Yosemite, and I am trying to communicate with my MySQL database using Perl.
This requires two things: (1) DBI and (2) the mysql driver module, DBD::mysql.
I ran into a lot of trouble installing the DBD::mysql portion. However, after following some instructions online, it now looks like DBD::mysql is installed, but I am skeptical that it has correctly.
In Terminal, when I load up cpan and then type "install DBD::mysql", it responds, "DBD::mysql is up to date (4.032)".
From the looks of it, then, it is installed. However, I am worried that what I've installed is enough for it to say, "Hey, I am installed!", but not enough for it to actually be functional, which would be why I'm having errors show up when I try to connect to my database with Perl:
install_driver(mysql) failed: Can't load '/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Perl/5.18/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at /System/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 194.
at (eval 6) line 3.
Compilation failed in require at (eval 6) line 3.
Perhaps a required shared library or dll isn't installed where expected
at login.pl line 9.
Relevant Perl code snippet:
my $dbh = DBI->connect(
"dbi:mysql:dbname=TEST",
"root",
"",
{ RaiseError => 1 },
) or die $DBI::errstr;
I am trying to troubleshoot whether this is a problem with my installation of DBD::mysql, or if it is my Perl code.
How can I verify whether my installation of DBD::mysql is all good? Better yet, how can I stop getting this error?
Thank you.
You could wrap the connect() call into an eval block to catch this error, however you don't have many options left if it crashes, probably just to try and produce a more user-friendly error messsage and then die anyway.
As for why you are getting the error, try checking where libmysqlclient.18.dylib lives on your system. It seems like it was somewhere where it could be found during compilation of the DBD::mysql driver but not during your script's runtime. Assuming it hasn't been accidentially uninstalled, adding its directory to the DYLD_LIBRARY_PATH variable should work. I don't know what config to add the path to to make that addition permanent on OSX though.