No module named 'torcheval' - python

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

Related

ModuleNotFoundError: No module named 'web3' on jupyter notebook

I am trying to run the following code in Jupyter Notebook using Anaconda (I used pip to install web3):
from web3 import Web3
w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
w3=util.connect(host="172.18.0.8",port="8545",poa=True)
assert w3.isConnected()
However, I get this Error Stack:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-10-0c63a16e1a59> in <module>
----> 1 from web3 import Web3
2
3 w3=web3.Web3(web3.Web3.HTTPProvider("http://172.18.0.1:8545"))
4 w3=util.connect(host="172.18.0.8",port="8545",poa=True)
5 assert w3.isConnected()
ModuleNotFoundError: No module named 'web3'
Anyone knows how to resolve this?
Okay, so I managed to find the answer myself with the help of #NicolaLandro: I did not use the command in the notebook.
However it worked, when I tried pip install web3 inside the conda prompt, after activating conda environment.

No module named 'gluonts.trainer'

!pip install gluonts
!pip install atspy
!pip install gluonts
from gluonts.mx.trainer import Trainer
from mxnet import gluon
from gluonts.trainer import Trainer
from atspy import AutomatedModel
However, it gives me an error:
ModuleNotFoundError Traceback (most recent call
last) in
4 from gluonts.mx.trainer import Trainer
5 from mxnet import gluon
----> 6 from gluonts.trainer import Trainer
7 from atspy import AutomatedModel
ModuleNotFoundError: No module named 'gluonts.trainer'
I have no ideas how to solve this. If anyone has any ideas
In the source code, I couldn't find gluonts.trainer either. Are you sure that you need line 6?
In my case, from gluonts.mx.trainer import Trainer was sufficient. (though I only needed to use gluonts once).

chembl_webresource_client install failed on google colab

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

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

Cannot import caffe into python, libjpeg.so.62 not found

I cannot import caffe into (anaconda-) python.
I'm following a notebook example on "logistic regression on non-image HDF5 data". When I execute the line
import caffe
I get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-17-3524921938b5> in <module>()
8 sys.path.insert(0, caffe_root + 'python')
9
---> 10 import caffe
11
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/__init__.py in <module>()
----> 1 from .pycaffe import Net, SGDSolver
2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver
3 from .proto.caffe_pb2 import TRAIN, TEST
4 from .classifier import Classifier
5 from .detector import Detector
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/pycaffe.py in <module>()
11 import numpy as np
12
---> 13 from ._caffe import Net, SGDSolver
14 import caffe.io
15
ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory
The library libjpeg.so.62 is definetly installed under /usr/lib/i386-linux-gnu/libjpeg.so.62. I don't know what is going wrong here or how to tell anacondapython where to look for libjpeg.so.62.
I already tried out sudo apt-get install libjpeg62:i386 but apt-get says "libjpeg62:i386 is already the newest version. libjpeg62:i386 set to manually installed."
I compiled caffe while modifying "Makefile.config" such that it was pointing it to the ananconda python path. I also exported the PYTHONPATH and PATH of my anaconda directory:
export PATH="/home/myName/libs/anaconda/bin:$PATH"
export PYTHONPATH="/home/myName/libs/caffe/caffe-master-anaconda-python/python:$PYTHONPATH"
Ok I finally found the solution:
I had to sudo apt-get install libjpeg62
After that a new error occurred while trying to import caffe, namely
ImportError: /home/myName/libs/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libx264.so.142)
That could be solved by removing some buggy anaconda libraries thus resorting to the system libraries,quote shelhamer:
"Some versions of Anaconda seem to come with a bad libm. rm ~/anaconda/lib/libm.* takes care of this by reverting to the system libm."
see github bvlc

Categories

Resources