Gigigi
Gigigi

Reputation: 21

InvalidVersion: Invalid version: '0.10.1,<0.11' in Colab when trying to "from allennlp.nn.util import sort_batch_by_length, masked_softmax"

I was using this for a couple of months just fine in Colab. But when I tired to work with it today I saw this error

InvalidVersion: Invalid version: '0.10.1,<0.11'

the error appears when I try to import form allennlp.nn.util

in here:

from allennlp.nn.util import sort_batch_by_length, masked_softmax

The whole error is:

---------------------------------------------------------------------------
InvalidVersion                            Traceback (most recent call last)
<ipython-input-62-dca1f0a13432> in <module>
      4 import torch.nn as nn
      5 import torch.nn.functional as F
----> 6 from allennlp.nn.util import sort_batch_by_length, masked_softmax
      7 #last_dim_softmax
      8 from torch.nn.utils.rnn import pack_padded_sequence

6 frames
/usr/local/lib/python3.8/dist-packages/packaging/version.py in __init__(self, version)
    195 
    196 def _legacy_cmpkey(version: str) -> LegacyCmpKey:
--> 197 
    198     # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
    199     # greater than or equal to 0. This will effectively put the LegacyVersion,

InvalidVersion: Invalid version: '0.10.1,<0.11'

I am using colab GPU, Python 3.8.10 allennlp==2.7.0

could someone help me with this please? Appreciate it.

I tried similar errors I found here

pip install packaging==21.3
and
pip install torchmetrics==0.6

none worked

Upvotes: 2

Views: 3558

Answers (0)

Related Questions