Medspacy colab install - spacy

Can anyone get medspacy to work on colab? I have tried reinstall of python 3.8 but no dice. I have tried installing medspacy via pip
Traceback (most recent call last)
in
1 import spacy
----> 2 import medspacy
3 from spacy.tokens import Span
4 from medspacy.sentence_splitting import PyRuSHSentencizer
5 from medspacy.section_detection import Sectionizer
ModuleNotFoundError: No module named 'medspacy'
NOTE: If your import is failing due to a missing package, you can
manually installCan anyone get medspacy to work on colab? I have tried reinstall of python 3.8 but no dice. I have tried installing medspacy via pip
low.
Can anyone get medspacy to work on colab? I have tried reinstall of python 3.8 but no dice. I have tried installing medspacy via pip.

Related

Huggingface transformers error: "from transformers.trainer_utils import get_last_checkpoint,is_main_process"

I am using Google Colab and trying to use transformers. first, I installed trasnformers using pip, and it installed successfully but I was still unable to import the following functions
from transformers.trainer_utils import get_last_checkpoint,is_main_process
Next I tried to install Transformers from source in a virtual environment. I installed it successfully, but was still getting the same error as shown below.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-53-d42272f1d6ac> in <module>()
----> 1 from transformers.trainer_utils import get_last_checkpoint,is_main_process
ModuleNotFoundError: No module named 'transformers.trainer_utils'
From comments
The issue fixed after installing "master" version from source as shown
below
pip install git+github.com/huggingface/transformers

I want to use pandas2ri in JUPYTER but tzlocal issue?

Everytime I try to import the pandas2ri in jupyter, python interface:
from rpy2.robjects import pandas2ri
I get the following error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-28-cc52694d111a> in <module>()
----> 1 from rpy2.robjects import pandas2ri
/Users/sondosayyash/anaconda/lib/python3.6/site-packages/rpy2/robjects/pandas2ri.py in <module>()
21 import numpy
22 import pytz
---> 23 import tzlocal
24 import warnings
25
ModuleNotFoundError: No module named 'tzlocal'
I tried to use
from dateutil.tz import tzlocal
but that didn't seem to fix the issue.
I've already installed tzlocal and it is on my computer. When I import pandas2ri on ipython, there is no problem.. the problem only occurs when calling in the jupyter environment.
this is the message I get when I try to install tzlocal again:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: tzlocal in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (1.5.1)
Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tzlocal) (2017.2)
I had a similar issue when running rpy2 in Jupyter. I did not have the package installed previously. I just installed the package and the error went away. You can try installing the package again to see if it helps resolve your issue.
pip install tzlocal
I must add that I am using Python 3.6.8 not 2.7
If using conda:
conda install tzlocal
worked.
I had a similar issue as yours. It turns out that my local lib did not have the tzlocal package. So I installed the package through Anaconda prompt:
pip install tzlocal
And the issue is gone.

Module Not found error on Google Colaboratory

Getting a weird import error when running the following code.
! pip install --user --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet
Basically, I'm trying to install keras_resnet for keras_retinanet on Google colab however I'm getting a not found error. Output is below. The installation completes but then the import fails. Tested it locally and it works only fails on Google Colaboratory.
Running setup.py install for keras-resnet ... - \ done
Successfully installed keras-resnet-0.0.8
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-25-4521fd3221d7> in <module>()
2 #os.chdir('keras-retinanet')
3 import keras
----> 4 import keras_resnet
5 #from keras-retinanet.keras_retinanet.models.resnet import custom_objects
6 #model = keras.models.load_model('/path/to/model.h5', custom_objects=custom_objects)
ModuleNotFoundError: No module named 'keras_resnet'
Try dropping the --user? This worked for me:
!pip install --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet

Installed BeautifulSoup but still get no module named bs4

I'm using a Jupyter notebook, Python 3.5, and a virtual environment.
Within my virtual env I did:
(venv) > pip install BeautifulSoup4
Which seemed to run fine b/c the terminal output was:
Downloading beautifulsoup4-4.6.0-py2-none-any.whl (86kB)
100% |████████████████████████████████| 92kB 297kB/s
Installing collected packages: BeautifulSoup4
Successfully installed BeautifulSoup4-4.6.0
But when I run my Jupyter notebook I get:
ImportError Traceback (most recent call last)
<ipython-input-1-5fe69888b1a1> in <module>()
5 from itertools import groupby
6 import pickle
----> 7 import bs4
8 import matplotlib.pyplot as plt
9 get_ipython().run_line_magic('matplotlib', 'inline')
ImportError: No module named 'bs4'
And I can't change the line import bs4 to from bs4 import BeautifulSoup which I've seen on other SO posts b/c its read-only and I'm not supposed to
Since you are using Python 3, I think you needed to do
pip3 install BeautifulSoup4
Just pip install would have been for the Python 2 package.
Other things to check:
First make sure you ran both the BeautifulSoup install in your virtualenv, and the python3 prompt or Jupyter notebook in your virtualenv. If you did the install in your root environment and the notebook is run in your virtualenv, or vice versa, you might have a mismatch in your site-packages directory.
Ensure that your package indeed installed by typing pip3 list at a command prompt, and noting that it appeared in the list.
Check that you Jupyter notebook is indeed running a Python 3.5 kernel (upper right hand corner of the browser window)
Check that the path where the package is installed is in your sys.path
Open a Python3 prompt or in Jupyter and run
import sys
print (sys.path)
I had the same problem, bs4 was installed in my virtual environment along with Jupyter Lab. Jupyter would throw the ModuleNotFound Error but if I opened the notebook in Visual Studio Code and chose the .venv as the interpreter, it worked.
I got it to work in Jupyter Lab by uninstalling from the virtual environment and installing with sudo apt-get install python3-bs4 instead.

No module named 'pandastable'

I'm trying to change table wrote by me on tkinter with the pandastable one in order to do the handling of data directly from a pandas.DataFrame.
But despite I have already installed Anaconda3 with matlplotlib, numpy, pandas ect. modules when i would like to import pandastable I have trouble.
This is the problem:
import pandastable
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import pandastable
ImportError: No module named 'pandastable'
pip install pandastable
Requires python>=3.3 or 2.7 and numpy, matplotlib and pandas.
See: pandastable on github
edit: You may have multiple Python environments installed on your machine. Anaconda uses conda install to keep things in check but pandastable doesn't seem to be available through Anaconda packages. Make sure you are installing to the same Python environment that your script uses. You might also try:
pip3 install pandastable