Pytorch error on multi-GPU setup: cannot import name 'invoke_remote_python_udf' from 'torch.distributed' - import

I'm getting this below error when importing Pytorch.
"cannot import name 'invoke_remote_python_udf' from 'torch.distributed'"

I faced the similar problem. For me , the problem was occuring due to mismatch in cuda version. I am using conda environment.
In my system the nvcc --version showed the result as 10.0' , while I had mistakenly install the pytorch for cuda version10.1`
I removed the torch and torchvision and re-installed them using the following command:
conda install pytorch torchvision cuda100 -c pytorch.
Installing the package cuda100 solved the problem.

Related

Unable to import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities'

I'm trying to import aitexten package to work on a GPT-2 solution. But I'm encountering an error:ImportError: cannot import name '_TPU_AVAILABLE' from 'pytorch_lightning.utilities' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/init.py)
I tried downgrading pytorch to v1.11.0 but that isn't helping too. Please help!
This worked for me in Google Colab. And it's with aitextgen version 0.6.
!pip uninstall -qqy torch torchvision torchtext torchaudio fastai
!pip install -qq torch==1.9.0 pytorch-lightning==1.7.7 aitextgen==0.6.0
I ran into the same problem! I fixed it by downgrading aitextgen.
In the beginning of my notebook, I ran this command:
!pip3 install -q aitextgen==0.5.2
Make sure to restart your kernel.
try this :
pytorch-lightning==1.4.0rc0
torchmetrics==0.6.0
aitextgen==0.5.2

AttributeError: module 'OpenSSL.SSL' has no attribute 'TLS_METHOD'

When trying to import scrapy in my Jupyter Notebooks via Anaconda (Windows), I get this error, which I havenĀ“t been able to solve. I'm working with Python 3.
What I did till now:
pip install Scrapy
pip install pyopenssl
import scrapy
and I get the following error:
TLS METHOD ERROR
Tks for your help.
Gisselle
I Have installed latest version of cryptography which worked for me . You can try it
pip install cryptography

Got cluster not defined when trying to run cluster.vq.vq() in Scipy lib

I am trying to learn anomaly detection by following :
https://github.com/sayakpaul/FloydHub-Anomaly-Detection-Blog/blob/master/FloydHub%20Anomaly%20Detection%20Blog.ipynb
I installed necessary libraries using:
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
cluster.vq.vq() is included in these libraries. However i am getting name error :
NameError: name 'cluster' is not defined
Any help is appreciated.
Now i solved my own question,
You just need to import:
from scipy.cluster.vq import vq
and instead of cluster.vq.vq(), vq() is enough

PyAudio import error : ImportError: DLL load failed: The specified module could not be found

I encountered an import problem by PyAudio.
I have a winodws 10, 64 bit, and use Anaconda and Spyder IDE with python 3.7.
I installed PyAudio in Ananconda, ran as administrator, with these commands :
cd
conda install -c conda-forge PyAudio
The installation ran without any problems.
I then restarted both Anaconda and SPYDER. PyAudio now shows up in Anaconda's list of installed packages.
When I try to import Pyaudio in Spyder (IPython console), I encounter this error message :
[1]: import pyaudio
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "", line 1, in
import pyaudio
File "C:\ProgramData\Anaconda3\lib\site-packages\pyaudio.py", line 116, in
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I tried to fix it by answers to similar ImportError message issued, while other users tried to import other packages like SKlearn ... , but with no success.
Your problem (and mine) are the same. The issue is, unfortunately, the version of python you're running (in tandem with your OS).
Check out this link:
https://people.csail.mit.edu/hubert/pyaudio/#:~:text=Note%3A%20As%20of%20this%20update,4.
Under the INSTALLATION section in the link for WINDOWS, PyAudio's latest version (0.2.11) is compatible with Python versions: 2.7, 3.4, 3.5, 3.6.
My current python is 3.8.5, so you (and I) could never use PyAudio unless they added compatibilities or we revert to an above python version.
I tried to install portaudio using
conda install portaudio
but it seems like it didn't work as it should be. However,
conda install -c anaconda portaudio
solved the problem.
see the official anaconda page

How to fix 'The kernel appears to have died. It will restart automatically" caused by pytorch

I have a strange problem with Pytorch. When I use torch functions with tensors like tensor.reshape or torch.transpose, I don't have any problems; even when I created networks, it's ok. However, when I want to train network my jupyter crashed.
I find where error is but I don't know why it is there and how to fix it.
I installed pytorch using conda. I have Ubuntu 18.04.
I don't have cuda.
If you are on Ubuntu you may not install PyTorch just via conda.
It can be:
Conda
Pip
LibTorch
From Source
So you have multiple options.
Go to this page and select Cuda to NONE, LINUX, stable 1.1, CONDA.
conda install pytorch-cpu torchvision-cpu -c pytorch
If you have problems still, you may try also install PIP way.
pip3 install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp36-cp36m-linux_x86_64.whl
pip3 install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp36-cp36m-linux_x86_64.whl
Hopefully some of these ways will work.
The hint for the solution is available, via the Jupyter notebook terminal (if opened it directly and not via the anaconda interface), where a more proper error code appears
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll
already initialized. OMP: Hint This means that multiple copies of the
OpenMP runtime have been linked into the program....
which then leads to a working solution here
sklearn OMP: Error #15 when fitting models
Simple Solution
I have solved this problem by reinstalling the torchvision, as this was the only library that was creating an issue, whenever i import that
Just reinstall that:
Directly in Jupyter notebook:
!pip3 uninstall -y torch torchvision
!pip3 install torch torchvision
or in Terminal:
pip3 uninstall -y torch torchvision
pip3 install torch torchvision
I had sort of the same issue (on a macos 12.6.2). A kernel crash when using torchvision.
trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
testset = torchvision.datasets.CIFAR10(root='./data', train=False,
download=True, transform=transform)
classes = ('plane', 'car', 'bird', 'cat',
'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
batch_size = 64
trainloader = th.utils.data.DataLoader(trainset, batch_size=batch_size,
shuffle=True, num_workers=0)
testloader = th.utils.data.DataLoader(testset, batch_size=batch_size,
shuffle=False, num_workers=0)
dataiter = iter(trainloader)
images, labels = next(dataiter)
I solved it by reinstalling pytorch and torchvision. Run in a script (jupyter notebook or elsewhere):
!conda install --yes pytorch torchvision -c pytorch