chembl_webresource_client install failed on google colab - python

need your help, I tried to install the chembl_webresource_client on colab, it usually works fine, but today to my surprise there is a mistake in the very first step.
! pip install chembl_webresource_client # install the client
from chembl_webresource_client.new_client import new_client # here is where is wrong
molecule = new_client.molecule
res = molecule.search('viagra')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-19aed0e54aea> in <module>()
----> 1 from chembl_webresource_client.new_client import new_client
2 molecule = new_client.molecule
3 res = molecule.search('viagra')
4 frames
/usr/local/lib/python3.7/dist-packages/chembl_webresource_client/cache.py in <module>()
1 __author__ = 'mnowotka'
2
----> 3 from requests_cache.backends.base import BaseCache, hashlib, _to_bytes
4
5 def create_key(self, request):
ImportError: cannot import name 'hashlib' from 'requests_cache.backends.base' (/usr/local/lib/python3.7/dist-packages/requests_cache/backends/base.py)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.

This is an issue with requests-cache. I downgraded to 0.5.2 and the error goes away.

This issue was fixed on version 0.10.3 of the chembl_webresource_client. Upgrading should fix it

Related

No module named 'torcheval'

I am trying this on Kaggle:
from torcheval.metrics.functional import binary_f1_score
metric = binary_f1_score
And i get an Error:
ModuleNotFoundError Traceback (most recent call last)
/tmp/ipykernel_28/3857382439.py in <module>
----> 1 from torcheval.metrics.functional import binary_f1_score
2 metric = binary_f1_score
3 model_no_CV = unet_1D().to(device)
4 optimizer = torch.optim.Adam(unet_1D.parameters(), lr=0.001)
5 epochs_num = 30
ModuleNotFoundError: No module named 'torcheval'
I tried to install the latest version of torch, didn't help
Other torch modules seem to work correctly
You have to install torcheval library in Kaggle. First of all make sure your internet option is enable to use the kernel then you can try this command:
!pip install torcheval

CHEMBL : Can't import new_client from chembl_webresource_client.new_client

I have installed the chembl_webresource_client package.
Then I tried to import a module from the package:
from chembl_webresource_client.new_client import new_client
But it fails to execute and this error appears:
ImportError Traceback (most recent call
last) in ()
1 # Import necessary libraries
2 import pandas as pd
----> 3 from chembl_webresource_client.new_client import new_client
4 frames
/usr/local/lib/python3.7/dist-packages/chembl_webresource_client/cache.py
in ()
1 author = 'mnowotka'
2
----> 3 from requests_cache.backends.base import BaseCache, hashlib, _to_bytes
4
5 def create_key(self, request):
ImportError: cannot import name 'hashlib' from
'requests_cache.backends.base'
(/usr/local/lib/python3.7/dist-packages/requests_cache/backends/base.py)
Is there a fix for this?
I have faced the same issue today and resolved it by updating chembl-webresource-client library's version from 0.10.2 to 0.10.3 in my project's requirements.txt file.
For example: chembl-webresource-client==0.10.3
Also after making these changes and activating your project's virtual environment, please don't forget to fetch and re-install all listed libraries in your requirements.txt using the following command:
pip install -r .\requirements.txt

Submodule import not working on Google Colab

I have a package called boo which I install on google colab from a github repository. The installation process looks fine and results in success message Successfully installed boo-0.1. However import boo fails on first internal import.
I replicated the same installation steps in a local virtual environment and package worked, but not on collab.
Here are my steps and error trace:
!rm -rf sandbox
!git clone https://github.com/ru-corporate/sandbox.git
!pip install -r sandbox/requirements.txt
!pip install sandbox/.
Alternatively, I tried
!pip install git+https://github.com/ru-corporate/sandbox.git#master
The error trace is:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-fc0b1d036b35> in <module>()
----> 1 import boo
/usr/local/lib/python3.6/dist-packages/boo/__init__.py in <module>()
----> 1 from boo.boo import download, build, read_dataframe, files
2 from boo.views.whatis import whatis
/usr/local/lib/python3.6/dist-packages/boo/boo.py in <module>()
3 from tqdm import tqdm
4
----> 5 from boo.file.download import curl
Basically, from root __init__.py the import goes to root boo.py and stumbles upon finding boo/file/download.py.
How do I make this package work on collab?
I could fix the subpackage behavior by editing setup.py as suggested here:
# ...
packages=setuptools.find_packages()
# ...
Somehow Colab is more restrictive on this parameter than local installation.

Getting numpy error when using azureml-sdk

hy I followed the installation instructions here
and installed with
pip install --upgrade azureml-sdk[notebooks,automl] azureml-dataprep --ignore-installed PyYAML
It seem to work but a simple
import azureml.core
azureml.core.VERSION
Throws me a numpy error
> AttributeError Traceback (most recent call
> last) <ipython-input-3-08b704cd5542> in <module>
> ----> 1 import azureml.core
> 2 azureml.core.VERSION
c:\users\werth\appdata\local\continuum\anaconda3\envs\azuresdk\lib\site-packages\azureml\core\__init__.py in <module>
4
5 """Setup file for core package."""
----> 6 from azureml.core.workspace import Workspace
7 from azureml.core.experiment import Experiment
8 from azureml.core.runconfig import RunConfiguration
... I did not include the total traceback as it is apparently a Azure import problem.
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'
It seems that the workspace has a problem. But I cannot think why. The Notebook is in a subfolder of the working directory. Numpy is installed.
If you would have an idea I would be thankfull.
Hi greatest Floridaman,
the answer is simple. During the installation of the azureml-train-automl 1.0.8 package, the numpy package needs to be maximum at version 1.15.0
So just downgrade numpy to that version
conda install numpy=1.15.0

ImportError: cannot import name Serializer

I am using python 2.7 and trying to run python-xbrl package. Following exact instructions here, but every time I try import xbrl or from xbrl import XBRLParser, GAAP, GAAPSerializer I get
ImportError Traceback (most recent call last)
<ipython-input-2-ccb496289539> in <module>()
----> 1 import xbrl
/usr/local/lib/python2.7/dist-packages/xbrl/__init__.py in <module>()
6 version = (1, 1, 0)
7
----> 8 from .xbrl import XBRLParser, GAAP, GAAPSerializer, XBRLParserException
/usr/local/lib/python2.7/dist-packages/xbrl/xbrl.py in <module>()
3
4 import re
----> 5 from marshmallow import Serializer, fields
6 import datetime
7 import collections
ImportError: cannot import name Serializer
So far I have updated all the required packages (pytest, pep8, marshmallow, beautifulsoup4, ordereddict, lxml, six) and updated python-xbrl, but I still get the same error.
It is a matter of the marshmallow version. Try -
pip uninstall marshmallow
pip install marshmallow==1.2.6
I believe this is a known issue, as seen here.
We just have to install the latest update from github.
sudo pip install git+https://github.com/greedo/python-xbrl.git

Categories

Resources