[For beginners] Install the package in the Anaconda environment (Janome)

Introduction This time, I will talk about how to install the package in the Anaconda environment, using Janome, a package for morphological analysis, as an example.

If you install a package other than Janome, the basic procedure is the same, so please read the "Janome" part.

Also, this article introduces the installation method for Windows, but it is almost the same for Mac, so please refer to it.

1. Install Anaconda [Anaconda](https://www.anaconda.com/products/individual) is a platform that allows you to easily build a Python environment for data science. Here, I will introduce how to install Anaconda ... I would like to say that [this site](https://www.python.jp/install/anaconda/windows/install.html "Installing Anaconda for Windows" It is explained in ") in a very easy-to-understand manner, so I will omit it. (For Mac, [here](https://www.python.jp/install/anaconda/macos/install.html "Installation of Anaconda for MacOS"))

2. Building a virtual environment This time, we will build a new virtual environment and install Janome in that environment. * If you have already built a virtual environment and want to install Janome there, skip it.

You can build a virtual environment with the following command. This time, the Python version is 3.7 and the environment name is "new_env", but change it if necessary.

command


$ conda create -n new_env python=3.7

Let's check if it was built. You can check the list of virtual environments with the following command.

command


$ conda info -e

Execution result


# conda environments:
#
base                   *  C:(abridgement)
new_env                  C:(abridgement)

In addition to the default environment called "base", there is an environment called "new_env". If it looks like this, it is a success. (Currently, base is enabled instead of new_env, so * [asterisk] is added to the base line.)

Supplement Please refer to [Janome official document](https://mocobeta.github.io/janome/) for the Python version required for Janome to work. As of 2020/10 (Janome v0.4), it seems to work with Python 3.6 or later.

3. Enable virtual environment There is no point in just building a virtual environment. If you want to use the built virtual environment, you need to "activate" it.

This time, the name of the virtual environment is "new_env", so you can enable it with the following command.

command


$ conda activate new_env

If the beginning of the line of the terminal changes from (base) to (new_env), it is successful.

By the way, if you want to disable the virtual environment (return from new_env to base), execute conda deactivate new_env.

4. Install Janome [Janome](https://mocobeta.github.io/janome/ "Janome v0.4 documentation (ja)") is a Python morphological analysis library. Here, we will introduce how to install Janome.

Installation by conda There are two types of commands that can be used when installing a package in the Anaconda environment, `pip` and` conda`, but ** It is recommended to use `conda` in the Anaconda environment **. It seems that this is to avoid problems due to differences in package management methods. However, `conda` has the weakness that there are fewer packages provided than` pip`.

Now, run the following command to see if Janome is provided.

command


$ conda search janome

Execution result (part)


…
PackagesNotFoundError: The following packages are not available from current channels:
…

As of 2020/10, it does not seem to be provided. I have no choice but to use pip.

Installation with pip Execute the following command to install Janome.

command


$ pip install janome

Let's display the list of installed packages and check if Janome has been installed.

command


conda list

Execution result


# packages in environment at C:(abridgement):
#
# Name                    Version                   Build  Channel
ca-certificates           2020.10.14                    0
certifi                   2020.6.20          pyhd3eb1b0_3
janome                    0.4.1                    pypi_0    pypi
openssl                   1.1.1h               he774522_0
pip                       20.2.4                   py37_0
python                    3.7.9                h60c2a47_0
setuptools                50.3.0           py37h9490d1a_1
sqlite                    3.33.0               h2a8f88b_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_3
wheel                     0.35.1                     py_0
wincertstore              0.2                      py37_0
zlib                      1.2.11               h62dcd97_4

You have janome properly! If you run ʻimport janome` on Python and you don't get any errors, you're done!

Finally Thank you for reading this far. You should be able to install packages other than Janome in the same way, so let's install them as needed.

References -[Install Anaconda for Windows](https://www.python.jp/install/anaconda/windows/install.html) -[Search and install packages not provided by conda from Anaconda Cloud](https://note.com/mc_kurita/n/n44e68e42ee84) -[[For beginners] Create a virtual environment with Anaconda](https://qiita.com/ozaki_physics/items/985188feb92570e5b82d#%E5%8F%82%E8%80%83%E6%96%87%E7 % 8C% AE) -[About package management with conda and pip](https://qiita.com/ynakayama/items/29efebeb38604d10acef) - [Janome v0.4 documentation (ja)](https://www.anaconda.com/products/individual)

Recommended Posts

[For beginners] Install the package in the Anaconda environment (Janome)
Install the package in an offline environment
Install the python package in an offline environment
Install scrapy in python anaconda environment
install tensorflow in anaconda + python3.5 environment
For beginners to build an Anaconda environment. (Memo)
Install python package in personal environment on Ubuntu
How to install the deep learning framework Tensorflow 1.0 in the Anaconda environment of Windows
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
Command line collection for using virtual environment in Anaconda
Use Anaconda in pyenv environment
Install Python environment with Anaconda
Pip install in proxy environment
Python3 environment construction (for beginners)
[Anaconda] Activate the virtual environment
Check the operation of Python for .NET in each environment
How about Anaconda for building a machine learning environment in Python?
[For beginners] Django -Development environment construction-
Various Anaconda settings in Windows 10 environment
Switch the package to be installed for each environment with poetry
Install Networkx in Python 3.7 environment for use in malware data science books
Created an environment for Anaconda & Jupyter
Jupyter Notebook 6.0.2 cannot be installed in the Python 2.7 environment created in Anaconda
Run unittests in Python (for beginners)
Prepare the environment for Atom for Pythonista
[Python] How to save the installed package and install it in a new environment at once Mac environment
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_3
Create a Python development environment locally at the fastest speed (for beginners)
(For myself) Flask_AWS_1 (Install PHP, MySQL, phpMyAdmin, Python in AWS virtual environment)
How to install python package in local environment as a general user
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_1
What are the "pipeline" and "{...}" in the Jenkins Pipeline pipeline {...} (for Groovy beginners, for experienced languages)
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
Switch the module to be loaded for each execution environment in Python
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_2
Programming environment for beginners made on Windows
Challenges for the Titanic Competition for Kaggle Beginners
Change the list in a for statement
The result of installing python in Anaconda
MongoDB for the first time in Python
Prepare the development environment for keyhac for Mac
Install rJava on Linux in R3.6 environment.
Creating a virtual environment in an Anaconda environment
Personal Note Package to install on Anaconda
Install CaboCha in a non-Anaconda environment (Win)
Install the Python module in any directory
[mac] Install R in pyenv + Jupyter-Lab environment
I can't install the package with pip.
[For beginners] Unexpected behavior if "\" is included when setting the path in Python
Think about the analysis environment (Part 3: Install pyenv + Anaconda [Python, R] + jupyter + Rstudio)
Instructions for connecting Google Colab. To the local runtime in a Windows environment
Libraries that should be included when creating APIs in the Django Rest Frakework environment, vscode extensions, etc. (for beginners)
Run PIFuHD in Windows + Anaconda + Git Bash environment
CERTIFICATE_VERIFY_FAILED in Python 3.6, the official installer for macOS
The fastest way for beginners to master Python
Use the latest pip in a virtualenv environment
Change the default reference repository for pip install
Building an Anaconda environment for Python with pyenv
[For beginners] What to do after installing Anaconda
Install Python 3.5.1 + numpy + scipy + α in Windows environment
Tips for hitting the ATND API in Python