MENU
Language

Steps to install pip on Lollipop server – Install Python packages (libraries)

pip is the official package management tool for Python, which is used to install, manage, and uninstall Python packages (libraries). pipYou can easily introduce external modules needed for Python development.

The steps to install Lollipop on a serverpip are similar to regular Linux servers, but since it is a shared server environment, you will install it in your own user directory.

The steps are explained below.


Preparation: SSH connection to Lollipop’s server

SSH Configuration Overview

  • Usage plan: SSH is available on the Standard plan and above.
  • Uses: Log in to servers, transfer files, and execute commands.
  • Note: rootPermissions aren’t available.

Setup Instructions

Enabling SSH

Log in to the user-only page.

Open SSH Settings and click Enable SSH.

Check your connection information

The hostname, username, and SSH port number are displayed.

Configuring SSH Clients

Connect using an SSH client (e.g., PuTTY, Terminal).

ssh ユーザー名@ホスト名 -p ポート番号

Reference: Lollipop Official – How to Set Up SSH
https://lolipop.jp/manual/user/ssh/

Step 1: Check the Python version

Lollipops come with Python pre-installed. Check your Python version with the command below.

python3 --version
  • Example output:
Python 3.7.17

If you have Python 3.x installed,pip you can set it up.


Step 2: get-pip.pyInstall using

Go to a writable directory

Navigate to the directory where the user has write permissions. Normally, you can go to your home directory and you’re fine.

cd ~

get-pip.pyDownload

curl -O https://bootstrap.pypa.io/get-pip.py

Note: For Python 3.7, download theget-pip.py supported version of

curl -O https://bootstrap.pypa.io/pip/3.7/get-pip.py

pipInstall

Use Python 3 to run the downloaded script.

python3 get-pip.py --user

Example of execution results

Collecting pip<24.1
  Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)
Collecting wheel
  Downloading wheel-0.42.0-py3-none-any.whl.metadata (2.2 kB)
Downloading pip-24.0-py3-none-any.whl (2.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 88.4 MB/s eta 0:00:00
Downloading wheel-0.42.0-py3-none-any.whl (65 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 kB 19.2 MB/s eta 0:00:00
Installing collected packages: wheel, pip
  WARNING: The script wheel is installed in '/home/users/0/XXXX.XXXX/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip, pip3 and pip3.7 are installed in '/home/users/0/XXXX.XXXX/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.0 wheel-0.42.0

[notice] A new release of pip is available: 23.1.2 -> 24.0
[notice] To update, run: python3 -m pip install --upgrade pip

The installation is successful, but I am getting the following warning:
/home/users/0/XXXX.XXXX/.local/bin is not included in the PATH
This may prevent you from executing the command pip directly, so set the PATH.
*XXXX.XXXXPlease replace it with your own.

Set the path

pipis installed in the user directory(~/.local/bin/), so add that directory to the environment variablePATH.

PATHSet in the current session Please enter the following command exactly:
This command is only valid for the current shell session.

export PATH=$PATH:/home/users/0/XXXX.XXXX/.local/bin

Persist the setting To enable it permanently,.bashrc you need to add it to the file. Run the following command:

echo 'export PATH=$PATH:/home/users/0/XXXX.XXXX/.local/bin' >> ~/.bashrc

Apply .bashrc changes Reload and apply the settings.

source ~/.bashrc

confirmation PATHCheck if it is added correctly:

echo $PATH

Example output:

/usr/local/bin:/usr/bin:/home/users/0/XXXX.XXXX/.local/bin:

pipCheck the operation of the check to see if it works correctly:

pip --version

Example in action:

pip 24.0 from /home/users/0/XXXX.XXXX/.local/lib/python3.7/site-packages/pip (python 3.7)

Troubleshooting: What to do if your Echo $PATH is duplicate fix permanently

.bashrcEditing

.bashrcEdit the file and add settings to automatically remove duplicates.

nano ~/.bashrc

The following script is added.

PATHAdd logic to remove duplicates.

export PATH=$(echo $PATH | tr ':' '\n' | awk '!seen[$0]++' | tr '\n' ':')

Save and Apply After saving, it will reflect your changes.

source ~/.bashrc

confirmation

PATHCheck if it is reflected correctly:

echo $PATH

pip use case – installing packages

Install the library using Installedpip.

Example: requestsInstalling a library

pip install --user requests
  • The~/.local/lib/python3.x/site-packages/ library you installed is placed in the

Other libraries are installed as needed.

pip install --user numpy
pip install --user paramiko
pip install --user pandas

Supplementary Information

  • Lollipop is a shared server environment, so you don’t have the authority to install packages on the entire system. That is why--user you should always use the option.
  • Python andpip other versions may vary depending on your server settings. Check out Lollipop’s support information.
Let's share this post !

Author of this article

AIアーティスト | エンジニア | ライター | 最新のAI技術やトレンド、注目のモデル解説、そして実践に役立つ豊富なリソースまで、幅広い内容を記事にしています。フォローしてねヾ(^^)ノ

Comments

To comment

目次