Mansour Shams
Mansour Shams

Reputation: 19

importing gensim and deprecated warning

I am importing gensim and get the following error after pip installing it:

219: CryptographyDeprecationWarning: Blowfish has been deprecated "class": algorithms.Blowfish,

How can I correct the situation?

pip install gensim and then imported:

!pip install gensim

import gensim

Upvotes: 0

Views: 790

Answers (2)

hamflow
hamflow

Reputation: 321

If your package still uses cryptography as an inside package and it needs it to do the basic functions so there is no way for installing them until the developers update package requirements. but if the package operates fine but shows a red warning in the output, then just uninstall cryptography package like below and said error won't be displayed:

conda uninstall cryptography --yes

I believe you can also use pip instead of conda.

In my case, this error happened when I imported below scipy modules. I don't know which one caused the error though:

from scipy.datasets import electrocardiogram
from scipy.signal import find_peaks

Upvotes: 0

gojomo
gojomo

Reputation: 54233

Gensim doesn't ever use the Blowfish encryption algorithm, and there are no references to cryptography.Blowfish inside the Gensim project's code, so this error is likely triggered from some other package that it transitively pulls in as one of its requirements.

You'd have to edit your question to show the entire error message (with all surrounding lines of 'traceback' & other details) – which is always a good idea when asking for help! – to give a better idea of what's really causing the message.

But also: 'deprecation' just means the creators of some code want to signal a feature is older & may go away entirely in the future, so beware relying on its indefinitely continuing functionality. And, a 'warning' doesn't mean an error or failure.

Often, such messages can be safely ignored, especially if:

  • they refer to code/features you're not using
  • your code will always be run by you, in an environment where you can choose to keep running the (older) versions of software you prefr – rather than distributed to many people, using a wide variety of system configurations, with a commitment by you (the author) to keep the software working on novel configurations of supporting libraries whose features change

Are you using Blowfish?

Are you creating software which will be distributed to others, with a support commitment that it will keep working even as the underlying libraries change arbitrarily?

If the answer to one or both of these is 'no', you likely don't have to worry about this deprecation warning. If seeing it bothers you or your users, it is possible to suppress the display of specific uninteresting warnings – see answers at: How to disable Python warnings?

But, be careful about hiding warnings in an overbroad fashion – someday there might be a warning about some functionality that you do rely on, and will want to adjust your code.

Upvotes: 0

Related Questions