how to download en_core_web_sm in orange3? - nlp

I want to use spacy inside Python script in Orange3 tool, but I get this error Can't find model 'en_core_web_sm' for using nlp = spacy.load("en_core_web_sm"). I wonder how I can install this model in orange3?. Btw, I am using Orange3 as individual tool , not inside Anaconda jupyter notebook
Error: Traceback (most recent call last): File "", line 1, in File "", line 2, in File "C:\Users\saif\AppData\Local\Orange\lib\site-packages\spacy__init__.py", line 30, in load return util.load_model(name, **overrides) File "C:\Users\saif\AppData\Local\Orange\lib\site-packages\spacy\util.py", line 169, in load_model raise IOError(Errors.E050.format(name=name)) OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory. >>>
Thanks in advance

It appears that spaCy wants you to download their models using their command line interface, however if you're working in a development environment where all you can do is write scripts and run them (which I assume is the case regarding Orange3), you can import the function that spaCy uses internally to download and install models and call that.
from spacy.cli.download import download
download('en_core_web_sm')

Related

H5py Driver Issue on Qiskit Nature Drivers

While using the IBM Quantum experience, whenever I want to install any driver an error with the h5py appears.
Specifically, the error is
"Using default_file_mode other than 'r' is no longer supported. Pass
the mode to h5py.File() instead."
Does anyone have any solutions to it (not sure which version to revert back to). Thanks!!
You will need to add more details about your question. I could not replicate your error based on the information you provided. This is what I did:
First, I installed Qiskit Nature with this command pip install qiskit[nature].
Next, I entered the following Python commands:
>>> from qiskit_nature.drivers.second_quantization import HDF5Driver
>>> h5f = HDF5Driver()
>>> h5f
<qiskit_nature.drivers.second_quantization.hdf5d.hdf5driver.HDF5Driver object at 0x7fa28320a820>
>>> h5f.run()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py", line 63, in run
raise LookupError(f"HDF5 file not found: {hdf5_file}")
LookupError: HDF5 file not found: molecule.hdf5
There is no error when I imported the HDF5Driver module from the qiskit_nature package. An error occurs when I enter h5f.run(). This is expected, because I don't have a file named molecule.hdf5 (the default filename). If you have a different filename, modify commands above to use h5f = HDF5Driver("your_filename").
Tests run with Python 3.8.12 and qiskit_nature 0.3.0 running on Ubuntu Linux 5.11.0-1023-gcp.

Error while configuring pycharm with odoo-13

I am trying to configure a new project to Odoo on Windows however when I run the project after specifying odoo-bin as the Script path this error appears to my:
Traceback (most recent call last):
File "D:/Odoo 13_20200903/server/odoo-bin", line 5, in <module>
import odoo
File "D:\Odoo 13_20200903\server\odoo\__init__.py", line 75, in <module>
import PyPDF2
ModuleNotFoundError: No module named 'PyPDF2'
Any idea how can it be fixed?
Thanks in Advance
The Python interpreter used differs from the interpreter in which the libraries are loaded, make sure that the required interpreter path, may be inside a venv or another name.

Pip install openslide completes successfully but when I import it "the specified module is not found"

I need to open SVS images in Python 3.7 and it seems that Openslide is the only module capable of opening images of that size (30k*30k pixels). I have used pip install openslide-python as well as python -m pip install openslide-python and pip 3 install... etc.
I know the module has been successfully installed because if I run any of those commands again the command line returns requirement already satisfied however when I run Python and try to import openslide it gives the error at the bottom.
My guess was that the .whl or .tar.gz files were in the wrong path so I made a bunch of copies and put them in the openslide folders within the Anaconda3 folder. The error persists. I have included the full error code below for clarity.
Extra: If I run help("modules") openslide shows up along with numpy, math, sklearn etc. I can import and run all other modules without issue.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\brimk\Anaconda3\lib\site-packages\openslide\__init__.py", line 29, in <module>
from openslide import lowlevel
File "C:\Users\brimk\Anaconda3\lib\site-packages\openslide\lowlevel.py", line 41, in <module>
_lib = cdll.LoadLibrary('libopenslide-0.dll')
File "C:\Users\brimk\Anaconda3\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\brimk\Anaconda3\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
My issue was resolved by the answer from my hero!
It seems that, at least for Openslide, running Python from the Path to the Bin is the easiest solution. It can be done this way.
Download the Windows Binary here.
Extract the download to whatever path you want.
Open command window
pip3 install openslide-python (pip2 if Python 2)
cd C:\Users\Path\to\Openslide-Win64-20171122\bin
python
import openslide
In the future you will have to run python from the path to the Openslide bin (Step 4). This can be done more rigorously by adding that file path to the PATH as described in detail here as well as in the answer above.

cx_Freeze converted exe: window closes immediately

I am trying to just convert my pygame python py to a .exe file using cx_Freeze. The setup file executes correctly and without error, but the issue is that when I run my .exe file the console window (the black cmd-like window)will open quickly and close. My .py which I want to convert is called Salary.py, and it includes a .input('str') codes in it so that the
user can decide which csv file they want to use.
Description of my Salary.py: if the user input an interger, Salary.py help them to parse through one existed csv file and run the
script and output to another csv file.
Chinese is included inside the code.
Once again, there is no error running when I run Salary.py in python3.6, and no error when building the exe file for now.
The setup.py I am using:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r'D:\Anaconda3\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'D:\Anaconda3\tcl\tcl8.6'
setup(name='Salary',
version='0.1',
description='Salarycount',
executables= [Executable("Salary.py")])
I try to execute the Salary.exe in cmd. And it gave this to me:
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "D:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "Salary.py", line 8, in <module>
File "D:\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Apperently, numpy has already installed to my python packages, I don't even know what does it mean.
my environment:
Anaconda 3
python 3.6
cx-Freeze 6.0b1
It looks like your Salary.py script uses the pandas package, is this correct? The pandas package requires the numpy package to work, and one needs to tell cx_Freeze explicitly to include the numpy package. Try to add the following options to setup:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r'D:\Anaconda3\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'D:\Anaconda3\tcl\tcl8.6'
setup(name='Salary',
version='0.1',
description='Salarycount',
options={'build_exe': {'packages': ['numpy']}},
executables= [Executable("Salary.py")])

Error training tensor-flow object detection api using google cloud VM. [ImportError: No module named 'tensorflow.python.eager']

When training tensor-flow object detection api using the typical steps in google cloud VM. After configuring all the dependence, when i try to run the train.py script the error [ImportError: No module named 'tensorflow.python.eager'] poped up. I already trained using the same steps in my local PC without any errors. I couldn't find any solution related to this error.
System Info: gcloud VM; TensorFlow-GPU 1.3.0; Python 3.5; CUDA 8.0 /cuDNN 6.0:
script running command:
$ python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=ssd_mobilenet_v1_lap.config
Error:
Traceback (most recent call last): File "train.py", line 49, in
from object_detection import trainer File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/trainer.py", line 33 , in
from deployment import model_deploy File "/home/ragulh28/project/models/research/slim/deployment/model_deploy.py",
line 106, in
from tensorflow.python.eager import context ImportError: No module named 'tensorflow.python.eager'
This issue is caused by a dependency on the new TF Eager API some of the newer models in slim use. They require the latest version of tensorflow, which is why the library is not being found.
Our apologies for the inconvenience. As a workaround, could you try checking out an older version of the Tensorflow Object Detection API? This commit should be a good candidate.

Resources