'LSTM' object has no attribute '_flat_weights_names' - python

While executing iNltk library, I am getting an error. I have latest versions of pytorch and torchvision.
'LSTM' object has no attribute '_flat_weights_names'
After re-searching on some blogs some people suggested to downgrade the version to 1.2 So i tried below installation from https://pytorch.org/get-started/previous-versions/
pip install torch==1.2.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html
However, getting errors
ERROR: Could not find a version that satisfies the requirement torch==1.2.0+cpu
ERROR: No matching distribution found for torch==1.2.0+cpu
Also, 1.3.1 version is missing.
Anybody has any idea about how to downgrade to 1.3.1 or 1.2.0?
Thanks in advance
PD

I tried using pip, but that did not work for me. conda fixed the issue.
Setup a conda environment first and activate it. Install iNLTK using pip in conda as follows:
pip install inltk
Remove the version of PyTorch installed as a dependency for iNLTK.
pip uninstall torch
Install the desired version of PyTorch.
conda install pytorch==1.3.0 -c pytorch
Refer: Previous PyTorch Versions

In google colaboratory,I got the same error while executing iNltk library.
In Inltk Installation (https://inltk.readthedocs.io/en/latest/api_docs.html)
they have provided as:
!pip install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
!pip install inltk
but the actual order of implementation is:
!pip install inltk
!pip install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html.
So by reversing order of execution of installation,solved error as the torch version gets corrected by following this order.

Related

Cannot import pymc3 module due to geweke

I've tried installing it on a separate env and installing arviz separately. The import pymc3 as pm will not work.
AttributeError: module 'arviz' has no attribute 'geweke'
It looks like the issue is related to the version of python (3.6) you are using and a dependant library pyMC use called arviz.
Make sure you uninstall the old version and follow the following steps to reinstall everything.
Uninstall using :
pip uninstall Theano Theano-PyMC PyMC3
Make sure you remove theano left overs by running :
sudo rm -fr the_python_path_u_are_using/lib/python3.6/site-packages/theano
And then install arviz with :
pip install arviz==0.10.0
And finally, install pymc3 again.
pip install pymc3
Try again and it will work.
It depends on your environment
For Anaconda:
Uninstall “arviz”
Use:
conda uninstall arviz
Now, install the latest version of “arviz”
For today, it is version 0.11.1
Use:
conda install arviz==0.11.1
For Non Anaconda environments:
Uninstall “arviz”
Use:
pip uninstall arviz
Now, install the latest version of “arviz”
Use:
pip install arviz==0.11.1
My environment: Ubuntu 18.04, Python 3.7.10
I have similar problem, after read this error at https://discourse.pymc.io/t/attributeerror-module-arviz-has-no-attribute-geweke/6818/4. The following commands solve the problem of AttributeError: module 'arviz' has no attribute 'geweke'
pip uninstall arviz
pip install arviz==0.11.0
pip install pymc3==3.10.0

cannot install pip install torchvision

I am using python 3.8.3 version, I tried to install torchvision and torch module and faced this error, none of them are installed. The error comes as ERROR:could not find a version that satisfies the requirement torch==1.4.0(from versions:0.1.2,0.1.2,post1,0.1.2.post2)
Error:No matching distribution found for torch==1.4.0
According to PyTorch's website, you must specify if you are using cpu or the version of CUDA when installing from pip.
For instance, if I wanted to install on a Linux system without CUDA, version 1.5.1 of PyTorch, I would run:
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
You can use the link I provided above to get the syntax for your specific environment.

How to install older version of Tensorflow?

I follow this tutorial. He uses Tensorflow 1.10.0. I should use that version too. Because tutorial is not compatible with newer versions of Tensorflow.
So,when I open Anaconda Prompt and write
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl
to base and I see this long error message. How can install Tensorflow 1.10.0?
I also tried:
conda create --name="tfold" python=3.7
conda activate tfold
pip install tensorflow==1.10.0
and I see this error message:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.10.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.10.0
EDIT: The oldest version compatible with Python 3.7 is 1.13. I installed Python 3.6. Then, I installed it using conda create -n test_env tensorflow=1.10.0
I think the problem is because you are using python3.7
Try using pip and not pip3
Set python=2.7 and use pip install tensorflow==1.10, it worked fine for me.

Python 3.5 virtualenv : pip3 installing tensorflow fails

I am running Mac OS 10.5 (Yosemite) and I just setup a virtualenv with python 3.5 to play a little bit with tensorflow. The virtualenv is setup correctly. However, I cannot install tensorflow. I always get the following error messages:
(tensorflow) Tom#MBP:~/tensorflow$ pip3 install --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
or this error:
(tensorflow) Tom#MBP:~/tensorflow$ pip3 install --upgrade \
> https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0-py2-none-any.whl
tensorflow-1.5.0-py2-none-any.whl is not a supported wheel on this platform.
I actually do not understand what is happening here.
Any help is appreciated. Thanks
Try upgrading pip to use latest version and see if it helps:
pip3 install --upgrade pip

Gensim: Slow version of gensim.models.doc2vec is being used

My setup is as follows:
Python version: 3.6.0
Numpy version: 1.13.0
Scipy version: 0.19.0
Gensim version: 2.1.0
GCC Compiler version: 5.3.0
System: Windows 7, 64bit
I get the following error with the setup above
import gensim
>>>Slow version of gensim.models.doc2vec is being used
This makes the run time far too slow when training models on gensim. I feel there is some problem with the package versions I am using or how I installed them because: I had to install numpy using pip; I had to install scipy using conda; and I had to install gensim using pip again. The reason for this setup, is because if I try to install scipy using pip, I get the error
>>>ImportError: DLL load failed: The specified procedure could not be found.
So I had to install scipy via conda. Also, if I try to install gensim using
conda install gensim
or
conda update gensim
it only installs version 1 - I have tried conda install -c anaconda gensim=2.1.0 but I get the error
PackageNotFoundError: Package missing in current win-64 channels:
- gensim 2.1.0*
Numpy and Scipy work fine independently when I import them into a script - that is, they import fine and I can use all their functionality. However, when they are being used by Gensim, clearly there is a problem and I don't know why.
Would anyone be able to advise possible fixes? Ideally I would like to keep all the latest versions of these packages if possible. Thank you in advance
NOTE: Gensim works fine with the "fast" version when I have Gensim version 1 installed and with the same versions of the dependencies above!
I also had this problem (I'm running ubuntu).
I found out that if i'm using directly the version from github, the problem is fixed.
So there are 2 solutions: (first uninstall gensim using pip uninstall gensim)
download and unzip the gensim zip file from gensim's github page, then CD to the folder of the zip content and run the command
python setup.py install
run this command pip install git+https://github.com/RaRe-Technologies/gensim#master#egg=gensim
I used the second and now I don't get the warnings
The problem is to do with the some underlying packages not being up to date. Here I found the answer which work for me, which is in short:
Uninstall Gensim
sudo pip3 uninstall gensim
Install python3-dev build-essential
sudo apt-get install python3-dev build-essential
Re-Install Gensim
sudo pip3 install --upgrade gensim
Notes:
Instructions above are for systems where pip and apt-get are used to manage packages
pip3 is the python3 version of pip

Categories