ImportError: cannot import name 'has_pattern' from 'gensim.utils' - python

I trying to import gensim.
But I got this error.
ImportError: cannot import name 'has_pattern' from 'gensim.utils' (C:\Users\admin\anaconda3\envs\tf-gpu\lib\site-packages\gensim\utils.py)
I will be grateful for any help.

Installing Version 3.4.0 solved the problem. Try the following :-
pip install gensim==3.4.0

First make sure you have gensim installed in your development environment along with its dependencies i.e. numpy, scipy and pattern:
conda install -c conda-forge gensim
conda install numpy
conda install -c anaconda scipy
conda install -c conda-forge pattern
If it's still not fixed then try updating conda:
conda update --all
also
conda update gensim
Maybe this would fix your issue!

Related

How install kmapper?

I have installed kmapper since command prompt, but when I import kmapper in jupyter notebook
is visualized a error: No module named kmapper.
What can I do?
I should install kmapper, please help me.
I don't see a Conda version for this in a major Anaconda Cloud channel. Install with pip.
conda create -n my_kmapper_env python pip numpy matplotlib scikit-learn bokeh pillow
conda activate my_kmapper_env
pip install kmapper

ImportError when importing matplotlib in my conda environment: cannot import name '_imaging' from 'PIL'

I'm new in the field, so sorry for possible silly mistakes.
I'm working with snakemake, so I created a conda environment following their directions:
conda install -c conda-forge mamba
mamba create -c conda-forge -c bioconda -n snakemake snakemake
However, while I was running the basic tutorial (enter link description here) a ModuleNotFoundError occurred:
snakemake --cores 1
ModuleNotFoundError: No module named 'matplotlib'
For this reason, I've installed matplotlib with conda-forge:
conda install -c conda-forge matplotlib
However, when I re-runned the tutorial, I got an ImportError:
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py)
So I decided to install in the same conda environment also pillow:
conda install -c conda-forge pillow
But I obtain the same error running the tutorial.
All of the imported packages are coming from my conda environment:
anaconda3/envs/snakemake/lib/python3.9/site-packages
Besides the path of PIL/pillow which is imported from:
usr/lib/python3/dist-packages
I also update conda, anaconda and all of the packages present in my snakemake environment. Moreover, I checked the presence of PIL with conda list and it is actualy present in my snakemake environment with the same path of other packages (anaconda3/envs/snakemake/lib/python3.9/site-packages).
I've noticed that in other issues it is suggested to uninstall and re install Pillow.
Howeever, when I try to uninstall:
pip uninstall Pillow
and
pip3 uninstall Pillow
I obtain:
PermissionError: [Errno 13] Permesso negato: 'BlpImagePlugin.cpython-38.pyc'
Therefore I've tried to force the upgrade:
pip install -U Pillow --user
and
pip3 install -U Pillow --user
And the terminal states that I have succesfully installed Pillow 8.0.1. However, when I import matplotlib the same error occurs:
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py)
I'm grateful for any hints
Thank you
I guess you missed a part in the setup for the tutorial (https://snakemake.readthedocs.io/en/stable/tutorial/setup.html). In step 2, you download an environment.yaml and use it to install all needed packages. Or you could try and install all packages yourself, look at the list under "Requirements".
Solved uninstalling from the system PIL package:
sudo apt-get remove python-pil
I still do not know why it works, but at least now I can use properly matplotlib

Unable to install scipy package in anaconda

My problem is that I want to use the package scipy in Spyder IDE(in Anaconda Navigator).
I tried to install this package with this code but this gives me an error.
conda install -c anaconda scipy
Anyone can help me?
I believe you are using version 3, try this option..
conda install -c scipy

No Module Named Tensorflow - Anaconda

I'm pretty new to Tensorflow. I've installed the package using
conda install -c conda-forge tensorflow
When I import tensorflow now, I get the No Module named Tensorflow error. I've been searching for a way out and have failed. It wold mean a lot if someone could help me with this. Thanks
run following commands:
conda create -n tensorflow
activate tensorflow
conda install -c conda-forge tensorflow
else you can install it with pip command:
pip install tensorflow

How can I use conda to install pydotplus

I execute the code following on my machine( Win10, python 2.7, Anaconda&Spyder) and meet ImportError: No module named pydotplus .
import networkx as nx
from networkx.drawing.nx_pydot import write_dot
G = nx.DiGraph([(1,2),(2,3),(3,2)])
write_dot(G,'file.dot')
It clearly that I should install pydotplus package. I try to conda install pydotplus directly but says Error: Package missing in current win-64 channels. Then, I google it but find there is no information about how to install it on conda. By the way, I have install pydot on conda before.
Thanks for you help in advance!
Using conda install command below worked for me (globally installed):
conda install -c conda-forge pydotplus
Using Anaconda environments (per environment instance) you can install pydotplus using pip:
pip install pydotplus
I would personally recommend using the Anaconda environments to install your packages for a given solution as its a more modular and cleaner way of building solutions with Anaconda.
Installing via Anaconda environments referenced from answer on Quora, see:
https://www.quora.com/How-do-I-install-Python-packages-in-Anaconda
I tried conda install pydotplus, but it failed.
Then tried python -m pip install pydotplus and it worked.
Try
pip install pydotplus
if it isn't part of the conda universe.
Open Anaconda prompt:
pip install pydotplus

Categories

Resources