[PYTHON] Install gensim in conda environment (and also install mecab)

Install gensim in conda environment

Conclusion

--It is better to stop the installation with conda --Please install with pip install gensim

What i did

Install gensim which is convenient for language processing etc.

$ conda install -c anaconda gensim

result

It took time anyway

Execution result

The result of executing the installation is listed below. It took a long time. I'm not sure why.

$ conda install -c anaconda gensim
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Examining certifi:  29%|████          | 19/66 [00:00<00:00, 7479.99it/s]
Comparing specs tha\ have this dependency:   0%|  | 0/2 [00:00<?, ?it/s]
Finding shortest conflict path for certifi[version='>=2016.09']:   0%| |Finding shortest conflict path- or certifi[version='>=2016.9.26']:  20%|Finding shortest conflict path for certifi[version='>=2016.9.26']:  40%|Finding- hortest conflict path for certifi:  40%|▍| 2/5 [21:13<16:35, 33Finding shortest conflict path for certifi:  60%|▌| 3/5 [21:13<13:50, 41Finding shortest conflict path| or certifi[version='>=2017.4.17']:  60%|Finding shortest conflict path for certifi[version='>=2017.4.17']:  80%|Finding shortes| conflict path for ca-certificates:  80%|▊| 4/5 [41:58<0Finding shortest conflict path for ca-certificates: 100%|█| 5/5 [41:58<0Comparing specs that have this dependency:  50%|▌| 1/2 [42:27<42:27, 2547.07s/it]            / 
Finding shortest conflict path for certifi[version='>=2016.9.26']:   0%|Finding shortest conflict path for ca-certificates:  33%|▎| 1/3 [00:00<0Finding shortest conflict path for ca-certificates:  67%|▋| 2/3 [00:00<0Finding shortest conflict path for certifi[version='>=2016.09']:  67%|▋|Comparing specs that have this dependency: 100%|█| 2/2 [42:27<00:00, 127Examining wheel:  41%|██████▏        | 27/66 [42:27<1:18:50, 121.30s/\ ]Comparing specs that have this dependency:  50%|▌| 1/2 [12:20<12:20, | 0
Examining pip:  48%|████████▏        | 32/66 [54:47<1:03:50, 112.67s/| ]
Comparing specs that have this dependency:  50%|▌| 1/2 [00:20<00:20, 20.
Examining python:  70%|███████████▊     | 46/66 [55:07<26:41, 80.08s// ]
Comparing specs that have this dependency:   0%|  | 0/2 [00:00<?, ?it/s]
Finding shortest conflict path for python=2.7:   6%| | 1/16 [00:16<04:13
Finding shortest conflict path for python=2.7:  12%|▏| 2/16 [00:16<01:58
Finding shortest conflict path for pyth/ -dateutil[version='>=2.1,<2.8.1
Finding shortest conflict path for python-dateutil[version='>=2.1,<2.8.1
Finding short/ t conflict path for python=3.8:  19%|▏| 3/16 [20:08<01:17
Finding shortest conflict path for python=3.8:  25%|▎| 4/16 [20:08<1:12:
Finding shortest conflict \ th for python[version='<=3.3']:  25%|▎| 4/16

Finding shortest conflict path for | thon[version='>=3.7,<3.8.0a0']:  31Finding shortest conflict path for python[version='>=3.7,<3.8.0a0']:  38Finding short| t conflict path for python=2.6:  38%|▍| 6/16 [35:28<1:08:Finding shortest conflict path for python=2.6:  44%|▍| 7/16 [35:28<42:58Finding sho\ est conflict path for python=3.3:  44%|▍| 7/16 [35:29<42:58Finding shortest conflict path for python=3.3:  50%|▌| 8/16 [35:29<26:45Finding shortest conflict path for pytho\ dateutil[version='>=2.1,<2.7.0Finding shortest conflict path for python-dateutil[version='>=2.1,<2.7.0Finding shortest conflict path for/ ython[version='>=3.6,<3.7.0a0']:  56Finding shortest conflict path for python[version='>=3.6,<3.7.0a0']:  62Finding shortest conflict path for python=3.6:  62%|▋| 10/16 [43:38<24:2Finding shortest conflict path for python| .6:  69%|▋| 11/16 [43:38<14:1Finding shortest conflict path for python-dateutil[version='>=2.1,<3.0.0Finding shor| st conflict path for python=3.4:  75%|▊| 12/16 [53:02<11:2Finding shortest conflict path for python=3.4:  81%|▊| 13/16 [53:02<10:1Finding shortest conflict path for- ython[version='>=2.7,<2.8.0a0']:  81Finding shortest conflict path for python[version='>=2.7,<2.8.0a0']:  88Finding shortest conflict path for- ython[version='>=3.5,<3.6.0a0']:  88Finding shortest conflict path for python[version='>=3.5,<3.6.0a0']:  94Finding shor\ st conflict path for python=3.5:  94%|▉| 15/16 [53:04<01:4Finding shortest conflict path for python=3.5: 100%|█| 16/16 [53:04<00:0Comparing specs that have this dependency:  50%|▌| 1/2 [53:04<53:04, 3184.33s/it]    
Finding shortest conflict path for python[version='>=3.8,<3.9.0a0']:   0Finding shortest conflict path for python=3.8:  50%|▌| 1/2 [00:00<00:00,Examining setuptools:  89%|████████▉ | 59/66 [1:48:12<14:30, 124.29s/it]C| paring specs that have this dependency:   0%|  | 0/2 [00:00<?, ?it/s]
Finding shortest conflict path for setuptools:   0%| | 0/1 [00:00<?, ?itComparing specs that have this dependency:  50%|▌| 1/2 [05:51<05:51, 351.71s/it]
Finding shortest conflict path for setuptools:   0%| | 0/1 [00:00<?, ?itfailed                                                                          
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - gensim -> python[version='2.6.*|2.7.*|3.3.*|3.4.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
  - gensim -> python[version='<=3.3']

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with each other:

Package certifi conflicts for:
python=3.8 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
gensim -> python=3.6 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
gensim -> smart_open[version='>=1.2.1'] -> requests -> certifi[version='>=2017.4.17']
Package wheel conflicts for:
gensim -> python=3.6 -> pip -> wheel
python=3.8 -> pip -> wheel
Package setuptools conflicts for:
gensim -> python=3.6 -> pip -> setuptools
python=3.8 -> pip -> setuptools
Package ca-certificates conflicts for:
gensim -> python=3.6 -> ca-certificates
python=3.8 -> openssl[version='>=1.1.1d,<1.1.2a'] -> ca-certificates
Package pip conflicts for:
gensim -> python=3.6 -> pip
python=3.8 -> pip
Package python-dateutil conflicts for:
gensim -> smart_open[version='>=1.2.1'] -> boto3 -> botocore[version='>=1.12.21,<1.13.0'] -> python-dateutil[version='>=2.1,<2.7.0|>=2.1,<2.8.1|>=2.1,<3.0.0']

I installed it with this and tried to actually run gensim, but in the end

     17 
     18 import MeCab
---> 19 from gensim import models
     20 
     21 from gensim.models.doc2vec import Doc2Vec, TaggedDocument

ModuleNotFoundError: No module named 'gensim'

I vomited.

What I did next

--Next, I installed it using pip.

$ pip install gensim

As a result, I was able to read it well.

Also install mecab

I was able to install it with the following command.

$ brew install mecab
$ pip install mecab

reference

Recommended Posts

Install gensim in conda environment (and also install mecab)
Install CaboCha in Ubuntu environment and call it with Python.
Install Mecab and mecab-python3 on Ubuntu 14.04
(Windows10) Install Linux environment and gnuplot.
Install scrapy in python anaconda environment
Windows10: Install MeCab library in python
install tensorflow in anaconda + python3.5 environment
Install pip in Serverless Framework and AWS Lambda with Python environment
Install Django in a pipenv virtual environment
Install rJava on Linux in R3.6 environment.
Install CaboCha in a non-Anaconda environment (Win)
[mac] Install R in pyenv + Jupyter-Lab environment
Install the package in an offline environment
Install python package in personal environment on Ubuntu
Create a virtual environment with conda in Python
Install Python 3.5.1 + numpy + scipy + α in Windows environment
Precautions when installing packages in the conda environment
Install LightGBM in an OS X virtualenv environment
Install OpenCV 3 (core + contrib) in Windows & Python 3 environment & Difference between OpenCV 2 and OpenCV 3 & Easy operation check
Install Python3 on Mac and build environment [Definitive Edition]
Allow Keras 2.0 and OpenCV 3.2 to work in GPU environment
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
[For beginners] Install the package in the Anaconda environment (Janome)
Note: CGI (during trial and error) in Vagrant environment
Install Ubuntu 20.04 with GUI and prepare the development environment
Until you install TensorFlow-GPU with pip in Windows environment
This and that around Mysql in Apache environment (Note)
How to install poetry (error handling) in zsh environment