shop_platform - 部署到 GCP (1)

我不太確定,終端機裡的哪些訊息要打馬賽克,姑且憑感覺自己手動打馬賽克*******

過程

啟用 Google Cloud 服務、建立專案、安裝 Google Cloud SDK

按照 WordPress / 架站教學一:使用 Google 台灣主機免費架設自己的網站 (Mac/Win版) 的教學,啟用 Google Cloud 服務、建立專案、安裝 Google Cloud SDK

話說,啟用 Google Cloud 服務時,教學裡有提到「雖然這裡一定要提供信用卡資訊,不過 Google 也說明了這只是在驗證你不是機器人。在你升級為付費帳號之前,即使你用完了一年 300 美金的免費額度,Google 也不會自動收取任何費用。」但我的 visa 卡在我啟用 Google Cloud 服務時被扣了台幣 40 元。不太確定是什麼情況。

安裝 Google Cloud SDK 過程如下:

(base) [~/Downloads/google-cloud-sdk] $ ./install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:

    gcloud config set disable_usage_reporting false

Do you want to help improve the Google Cloud SDK (y/N)?  N


Your current Cloud SDK version is: 361.0.0
The latest available version is: 361.0.0

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                 Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬──────────┤
│     Status    │                         Name                         │            ID            │   Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions                             │ app-engine-go            │  4.8 MiB │
│ Not Installed │ Appctl                                               │ appctl                   │ 18.5 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │  7.6 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │  6.6 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │  < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │ 18.4 MiB │
│ Not Installed │ Cloud Firestore Emulator                             │ cloud-firestore-emulator │ 40.4 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │ 60.7 MiB │
│ Not Installed │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │  7.4 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │ 14.5 MiB │
│ Not Installed │ Google Cloud Build Local Builder                     │ cloud-build-local        │  6.2 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │  2.2 MiB │
│ Not Installed │ Kustomize                                            │ kustomize                │  7.6 MiB │
│ Not Installed │ Minikube                                             │ minikube                 │ 26.6 MiB │
│ Not Installed │ Nomos CLI                                            │ nomos                    │ 24.4 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper             │ local-extract            │ 12.5 MiB │
│ Not Installed │ Skaffold                                             │ skaffold                 │ 20.0 MiB │
│ Not Installed │ anthos-auth                                          │ anthos-auth              │ 18.0 MiB │
│ Not Installed │ config-connector                                     │ config-connector         │ 45.2 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │  < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │  < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 52.7 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │ 21.9 MiB │
│ Not Installed │ gcloud app Python Extensions                         │ app-engine-python        │  7.8 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │ 26.4 MiB │
│ Not Installed │ kpt                                                  │ kpt                      │ 12.8 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  < 1 MiB │
│ Not Installed │ kubectl-oidc                                         │ kubectl-oidc             │ 18.0 MiB │
│ Not Installed │ pkg                                                  │ pkg                      │          │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │  < 1 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │ 20.7 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │  8.1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴──────────┘
To install or remove components at your current SDK version [361.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [361.0.0], run:
  $ gcloud components update


Modify profile to update your $PATH and enable shell command completion?

Do you want to continue (Y/n)?  Y

The Google Cloud SDK installer will now prompt you to update an rc file to bring
 the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use 
[/Users/flora/.bash_profile]:      
Backing up [/Users/flora/.bash_profile] to [/Users/flora/.bash_profile.backup].
[/Users/flora/.bash_profile] has been updated.

==> Start a new shell for the changes to take effect.


Cloud SDK works best with Python 3.7 and certain modules.

Python 3.7 installation detected, install recommended modules? (Y/n)?  Y

Setting up virtual environment
Creating virtualenv...
Installing modules...
     |████████████████████████████████| 89 kB 705 kB/s 
     |████████████████████████████████| 21.2 MB 4.0 MB/s 
     |████████████████████████████████| 559 kB 8.4 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
     |████████████████████████████████| 149 kB 3.3 MB/s 
  Building wheel for cryptography (PEP 517) ... error
  ERROR: Failed building wheel for cryptography
  Building wheel for google-crc32c (PEP 517) ... done
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
ERROR: Virtual env setup failed.

安裝期間,安裝程式說 Cloud SDK 在 Python 3.7 和某些模組上運作得最好,問我要不要安裝。雖然我有點擔心,他會用什麼方式安裝 Python 3.7(我使用 pyenv 管理不同版本的 python),不過我還是讓他安裝了。結果看起來是失敗了,目前還看不太懂那個失敗是怎麼回事,不過我猜應該沒什麼關係,畢竟,他只是推薦我「在 Python 3.7 和某些模組上運作得最好」,安裝失敗應該不至於跑不動才對。先記錄下來以後慢慢查。

重新開一個終端機,讓 bash_profile 的設定生效。


設定 region 和 zone

繼續按照 WordPress / 架站教學一:使用 Google 台灣主機免費架設自己的網站 (Mac/Win版) 的教學,啟用 Google Cloud SDK。然後按照終端機的提示,參考 https://cloud.google.com/compute/docs/gcloud-compute 中的資訊,設定 region 和 zone,然後再次初始化以套用變更後的設定。

(base) [~] $ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                            
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must log in to continue. Would you like to log in (Y/n)?  Y

Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?*******

You are logged in as: [*******@*******.com].

Pick cloud project to use: 
 [1] fleet-space-329815
 [2] shop-platform-329816
 [3] Create a new project
Please enter numeric choice or text value (must exactly match list item):  2

Your current project has been set to: [shop-platform-329816].

Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.

Created a default .boto configuration file at [/Users/flora/.boto]. See this file and
[https://cloud.google.com/storage/docs/gsutil/commands/config] for more
information about configuring Google Cloud Storage.
Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use *******@*******.com by default
* Commands will reference project `shop-platform-329816` by default
Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
(base) [~] $ echo $CLOUDSDK_CORE_PROJECT

(base) [~] $ gcloud config get-value compute/region
(unset)
(base) [~] $ gcloud compute regions list
API [compute.googleapis.com] not enabled on project [1025317115533]. Would you 
like to enable and retry (this will take a few minutes)? (y/N)?  y

Enabling service [compute.googleapis.com] on project [1025317115533]...
Operation "operations/acf.p2-1025317115533-1301c815-1139-4a25-91c1-f6603325b56d" finished successfully.
NAME                     CPUS  DISKS_GB  ADDRESSES  RESERVED_ADDRESSES  STATUS  TURNDOWN_DATE
asia-east1               0/8   0/2048    0/4        0/8                 UP
asia-east2               0/8   0/2048    0/4        0/8                 UP
asia-northeast1          0/8   0/2048    0/4        0/8                 UP
asia-northeast2          0/8   0/2048    0/4        0/8                 UP
asia-northeast3          0/8   0/2048    0/4        0/8                 UP
asia-south1              0/8   0/2048    0/4        0/8                 UP
asia-south2              0/8   0/2048    0/4        0/8                 UP
asia-southeast1          0/8   0/2048    0/4        0/8                 UP
asia-southeast2          0/8   0/2048    0/4        0/8                 UP
australia-southeast1     0/8   0/2048    0/4        0/8                 UP
australia-southeast2     0/8   0/2048    0/4        0/8                 UP
europe-central2          0/8   0/2048    0/4        0/8                 UP
europe-north1            0/8   0/2048    0/4        0/8                 UP
europe-west1             0/8   0/2048    0/4        0/8                 UP
europe-west2             0/8   0/2048    0/4        0/8                 UP
europe-west3             0/8   0/2048    0/4        0/8                 UP
europe-west4             0/8   0/2048    0/4        0/8                 UP
europe-west6             0/8   0/2048    0/4        0/8                 UP
northamerica-northeast1  0/8   0/2048    0/4        0/8                 UP
northamerica-northeast2  0/8   0/2048    0/4        0/8                 UP
southamerica-east1       0/8   0/2048    0/4        0/8                 UP
us-central1              0/8   0/2048    0/4        0/8                 UP
us-east1                 0/8   0/2048    0/4        0/8                 UP
us-east4                 0/8   0/2048    0/4        0/8                 UP
us-west1                 0/8   0/2048    0/4        0/8                 UP
us-west2                 0/8   0/2048    0/4        0/8                 UP
us-west3                 0/8   0/2048    0/4        0/8                 UP
us-west4                 0/8   0/2048    0/4        0/8                 UP
(base) [~] $ gcloud config set compute/region asia-east1
Updated property [compute/region].
(base) [~] $ gcloud compute zones list
NAME                       REGION                   STATUS  NEXT_MAINTENANCE  TURNDOWN_DATE
us-east1-b                 us-east1                 UP
us-east1-c                 us-east1                 UP
us-east1-d                 us-east1                 UP
us-east4-c                 us-east4                 UP
us-east4-b                 us-east4                 UP
us-east4-a                 us-east4                 UP
us-central1-c              us-central1              UP
us-central1-a              us-central1              UP
us-central1-f              us-central1              UP
us-central1-b              us-central1              UP
us-west1-b                 us-west1                 UP
us-west1-c                 us-west1                 UP
us-west1-a                 us-west1                 UP
europe-west4-a             europe-west4             UP
europe-west4-b             europe-west4             UP
europe-west4-c             europe-west4             UP
europe-west1-b             europe-west1             UP
europe-west1-d             europe-west1             UP
europe-west1-c             europe-west1             UP
europe-west3-c             europe-west3             UP
europe-west3-a             europe-west3             UP
europe-west3-b             europe-west3             UP
europe-west2-c             europe-west2             UP
europe-west2-b             europe-west2             UP
europe-west2-a             europe-west2             UP
asia-east1-b               asia-east1               UP
asia-east1-a               asia-east1               UP
asia-east1-c               asia-east1               UP
asia-southeast1-b          asia-southeast1          UP
asia-southeast1-a          asia-southeast1          UP
asia-southeast1-c          asia-southeast1          UP
asia-northeast1-b          asia-northeast1          UP
asia-northeast1-c          asia-northeast1          UP
asia-northeast1-a          asia-northeast1          UP
asia-south1-c              asia-south1              UP
asia-south1-b              asia-south1              UP
asia-south1-a              asia-south1              UP
australia-southeast1-b     australia-southeast1     UP
australia-southeast1-c     australia-southeast1     UP
australia-southeast1-a     australia-southeast1     UP
southamerica-east1-b       southamerica-east1       UP
southamerica-east1-c       southamerica-east1       UP
southamerica-east1-a       southamerica-east1       UP
asia-east2-a               asia-east2               UP
asia-east2-b               asia-east2               UP
asia-east2-c               asia-east2               UP
asia-northeast2-a          asia-northeast2          UP
asia-northeast2-b          asia-northeast2          UP
asia-northeast2-c          asia-northeast2          UP
asia-northeast3-a          asia-northeast3          UP
asia-northeast3-b          asia-northeast3          UP
asia-northeast3-c          asia-northeast3          UP
asia-south2-a              asia-south2              UP
asia-south2-b              asia-south2              UP
asia-south2-c              asia-south2              UP
asia-southeast2-a          asia-southeast2          UP
asia-southeast2-b          asia-southeast2          UP
asia-southeast2-c          asia-southeast2          UP
australia-southeast2-a     australia-southeast2     UP
australia-southeast2-b     australia-southeast2     UP
australia-southeast2-c     australia-southeast2     UP
europe-central2-a          europe-central2          UP
europe-central2-b          europe-central2          UP
europe-central2-c          europe-central2          UP
europe-north1-a            europe-north1            UP
europe-north1-b            europe-north1            UP
europe-north1-c            europe-north1            UP
europe-west6-a             europe-west6             UP
europe-west6-b             europe-west6             UP
europe-west6-c             europe-west6             UP
northamerica-northeast1-a  northamerica-northeast1  UP
northamerica-northeast1-b  northamerica-northeast1  UP
northamerica-northeast1-c  northamerica-northeast1  UP
northamerica-northeast2-a  northamerica-northeast2  UP
northamerica-northeast2-b  northamerica-northeast2  UP
northamerica-northeast2-c  northamerica-northeast2  UP
us-west2-a                 us-west2                 UP
us-west2-b                 us-west2                 UP
us-west2-c                 us-west2                 UP
us-west3-a                 us-west3                 UP
us-west3-b                 us-west3                 UP
us-west3-c                 us-west3                 UP
us-west4-a                 us-west4                 UP
us-west4-b                 us-west4                 UP
us-west4-c                 us-west4                 UP
(base) [~] $ gcloud config set compute/zone asia-east1-b
Updated property [compute/zone].
(base) [~] $ gcloud compute project-info add-metadata \
>    --metadata google-compute-default-region=asia-east1,google-compute-default-zone=asia-east1-b
Updated [https://www.googleapis.com/compute/v1/projects/shop-platform-329816].
(base) [~] $ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
compute:
  region: asia-east1
  zone: asia-east1-b
core:
  account: *******@*******.com
  disable_usage_reporting: 'True'
  project: shop-platform-329816

Pick configuration to use:
 [1] Re-initialize this configuration [default] with new settings 
 [2] Create a new configuration
Please enter your numeric choice:  1

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                            
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

Choose the account you would like to use to perform operations for this 
configuration:
 [1] *******@*******.com
 [2] Log in with a new account
Please enter your numeric choice:  1

You are logged in as: [*******@*******.com].

Pick cloud project to use: 
 [1] fleet-space-329815
 [2] shop-platform-329816
 [3] Create a new project
Please enter numeric choice or text value (must exactly match list item):  2

Your current project has been set to: [shop-platform-329816].

Your project default Compute Engine zone has been set to [asia-east1-b].
You can change it by running [gcloud config set compute/zone NAME].

Your project default Compute Engine region has been set to [asia-east1].
You can change it by running [gcloud config set compute/region NAME].

Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use *******@*******.com by default
* Commands will reference project `shop-platform-329816` by default
* Compute Engine commands will use region `asia-east1` by default
* Compute Engine commands will use zone `asia-east1-b` by default

Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting

開 VM

我是在 GCP 網頁上跟著網站的教學開 VM,過程忘記截圖,不過大致如 第一次開 Google VM 就上手 – Compute Engine 操作簡介 這篇教學所示。我安裝的作業系統是 ubuntu 18.04 LTS

然後根據 Udemy Web Developer Bootcamp with Flask and Python課程中的 Deploying your apps manually to a server,接下來我應該要用 ssh 連線 VM,安裝 python 和 MySQL


用 ssh 連到雲端的 VM

根據 LEARN > Start your project > Connect to your instance 中的指示,要在自己電腦上的終端機,用 ssh 連到雲端的 VM,可以使用 gcloud SDK 的 gcloud compute ssh 指令。

(base) [~] $ gcloud compute ssh *****
WARNING: The private SSH key file for gcloud does not exist.
WARNING: The public SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in *****
Your public key has been saved in *****
The key fingerprint is:
*****
The key's randomart image is:
+---[RSA 3072]----+
|*****************|
+----[SHA256]-----+
Updating project ssh metadata...⠼Updated [https://www.googleapis.com/compute/v1/projects/shop-platform-329816].
Updating project ssh metadata...done.                                          
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.1740582826167716329' (ECDSA) to the list of known hosts.
Enter passphrase for key '*****': 
Enter passphrase for key '*****': 
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1026-gcp x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Oct 27 04:53:46 UTC 2021

  System load:  0.04              Processes:           104
  Usage of /:   26.5% of 9.52GB   Users logged in:     0
  Memory usage: 25%               IP address for ens4: 10.140.0.2
  Swap usage:   0%

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

121 packages can be updated.
5 updates are security updates.

New release '20.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


*** System restart required ***
flora@server:~$ Connection to 34.80.108.187 closed by remote host.

似乎是,因為沒做過 SSH key 相關的設定,所以要先做一個。

稍微查了一下看不懂的字:

Udemy Web Developer Bootcamp with Flask and Python 課程中,ssh 連線到 DigitalOcean 的 VM 後,輸入 pwd 顯示 /root,所以講師創建了一個一般的使用者,並設定相關權限。不過我 ssh 連線到 GCP 的 VM 後,輸入 pwd 顯示 /home/flora,大概是 GCP 有幫我做了什麼設定,我猜應該可以跳過「創建一般的使用者」這個步驟。

安裝 python

除了 上述的 Udemy 課程,也對照了 如何在 Ubuntu 18.04 上安装 Python 3.9 這篇文章。

安裝 python 3.9

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install build-essential python3.9-dev python3-pip python3.9

安裝 pipenv,並設定 ~/.bashrc 檔:

pip3 install --user pipenv
echo "PATH=$HOME/.local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

安裝 MySQL

參考如何在Ubuntu 18.04 LTS中安裝和配置MySQL

root 要改成用密碼進行身份驗證,因為我後來發現 app 是用密碼登入資料庫的,沒改的話會連線失敗。

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1698, "Access denied for user 'root'@'localhost'")

進入 MySQL command prompt 建立資料庫(這時還沒把 root 改成用密碼進行身份驗證,所以可用 sudo mysql 登入資料庫)

sudo mysql
CREATE DATABASE shop_platform;
exit

準備好專案程式碼

git clone https://github.com/Flora2020/shop_platform.git
cd shop_platform/
pipenv install

pipenv install 後的執行結果,看來不太順利

flora@*****:~/shop_platform$ pipenv install
Creating a virtualenv for this project...
Pipfile: /home/flora/shop_platform/Pipfile
Using /usr/bin/python3.9 (3.9.7) to create virtualenv...
⠼ Creating virtual environment...created virtual environment CPython3.9.7.final.0-64 in 801ms
  creator CPython3Posix(dest=/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/flora/.local/share/virtualenv)
    added seed packages: pip==21.3.1, setuptools==58.3.0, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! 
Failed to load paths: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'

Output: 
Virtualenv location: /home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM
Installing dependencies from Pipfile.lock (39fa9f)...
Failed to load paths: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'

Output: 
Failed to load paths: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'distutils.sysconfig'

Output: 
An error occurred while installing alembic==1.7.4; python_version >= '3.6' --hash=sha256:e3cab9e59778b3b6726bb2da9ced451c6622d558199fd3ef914f3b1e8f4ef704 --hash=sha256:9d33f3ff1488c4bfab1e1a6dfebbf085e8a8e1a3e047a43ad29ad1f67f012a1d! Will try again.
An error occurred while installing blinker==1.4 --hash=sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6! Will try again.
An error occurred while installing click==8.0.3; python_version >= '3.6' --hash=sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b --hash=sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3! Will try again.
An error occurred while installing dnspython==2.1.0; python_version >= '3.6' --hash=sha256:e4a87f0b573201a0f3727fa18a516b055fd1107e0e5477cded4a2de497df1dd4 --hash=sha256:95d12f6ef0317118d2a1a6fc49aac65ffec7eb8087474158f42f26a639135216! Will try again.
An error occurred while installing email-validator==1.1.3 --hash=sha256:5675c8ceb7106a37e40e2698a57c056756bf3f272cfa8682a4f87ebd95d8440b --hash=sha256:aa237a65f6f4da067119b7df3f13e89c25c051327b2b5b66dc075f33d62480d7! Will try again.
An error occurred while installing flask==2.0.2 --hash=sha256:cb90f62f1d8e4dc4621f52106613488b5ba826b2e1e10a33eac92f723093ab6a --hash=sha256:7b2fb8e934ddd50731893bdcdb00fc8c0315916f9fcd50d22c7cc1a95ab634e2! Will try again.
An error occurred while installing flask-imgur==0.1 --hash=sha256:2e1fb495d565a2caaa0606a7bd5de4138a068f634c74eea9abead33bc318623c! Will try again.
An error occurred while installing flask-mail==0.9.1 --hash=sha256:22e5eb9a940bf407bcf30410ecc3708f3c56cc44b29c34e1726fe85006935f41! Will try again.
An error occurred while installing flask-migrate==3.1.0 --hash=sha256:a6498706241aba6be7a251078de9cf166d74307bca41a4ca3e403c9d39e2f897 --hash=sha256:57d6060839e3a7f150eaab6fe4e726d9e3e7cffe2150fb223d73f92421c6d1d9! Will try again.
An error occurred while installing flask-seeder==1.2.0 --hash=sha256:8ffa20de8fdfe8af1852f994d5b8e41792faf8f90e0065e1c6b6f71e324cb7ea --hash=sha256:7fcfd2ad9aa0b7aad32b0d4684d2ee6cfcbc06a5ba1f8e3fe6ea07bf0f5b757c! Will try again.
An error occurred while installing flask-sqlalchemy==2.5.1 --hash=sha256:2bda44b43e7cacb15d4e05ff3cc1f8bc97936cc464623424102bfc2c35e95912 --hash=sha256:f12c3d4cc5cc7fdcc148b9527ea05671718c3ea45d50c7e732cceb33f574b390! Will try again.
An error occurred while installing flask-wtf==0.15.1 --hash=sha256:ff177185f891302dc253437fe63081e7a46a4e99aca61dfe086fb23e54fff2dc --hash=sha256:6ff7af73458f182180906a37a783e290bdc8a3817fe4ad17227563137ca285bf! Will try again.
An error occurred while installing greenlet==1.1.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' --hash=sha256:32ca72bbc673adbcfecb935bb3fb1b74e663d10a4b241aaa2f5a75fe1d1f90aa --hash=sha256:64e6175c2e53195278d7388c454e0b30997573f3f4bd63697f88d855f7a6a1fc --hash=sha256:e6a36bb9474218c7a5b27ae476035497a6990e21d04c279884eb10d9b290f1b1 --hash=sha256:8639cadfda96737427330a094476d4c7a56ac03de7265622fcf4cfe57c8ae18d --hash=sha256:fdcec0b8399108577ec290f55551d926d9a1fa6cad45882093a7a07ac5ec147b --hash=sha256:b92e29e58bef6d9cfd340c72b04d74c4b4e9f70c9fa7c78b674d1fec18896dc4 --hash=sha256:dd0b1e9e891f69e7675ba5c92e28b90eaa045f6ab134ffe70b52e948aa175b3c --hash=sha256:fa877ca7f6b48054f847b61d6fa7bed5cebb663ebc55e018fda12db09dcc664c --hash=sha256:58df5c2a0e293bf665a51f8a100d3e9956febfbf1d9aaf8c0677cf70218910c6 --hash=sha256:8c790abda465726cfb8bb08bd4ca9a5d0a7bd77c7ac1ca1b839ad823b948ea28 --hash=sha256:356b3576ad078c89a6107caa9c50cc14e98e3a6c4874a37c3e0273e4baf33de8 --hash=sha256:e30f5ea4ae2346e62cedde8794a56858a67b878dd79f7df76a0767e356b1744a --hash=sha256:7cbd7574ce8e138bda9df4efc6bf2ab8572c9aff640d8ecfece1b006b68da963 --hash=sha256:f70a9e237bb792c7cc7e44c531fd48f5897961701cdaa06cf22fc14965c496cf --hash=sha256:e859fcb4cbe93504ea18008d1df98dee4f7766db66c435e4882ab35cf70cac43 --hash=sha256:95e69877983ea39b7303570fa6760f81a3eec23d0e3ab2021b7144b94d06202d --hash=sha256:1e12bdc622676ce47ae9abbf455c189e442afdde8818d9da983085df6312e7a1 --hash=sha256:f0214eb2a23b85528310dad848ad2ac58e735612929c8072f6093f3585fd342d --hash=sha256:049fe7579230e44daef03a259faa24511d10ebfa44f69411d99e6a184fe68073 --hash=sha256:7418b6bfc7fe3331541b84bb2141c9baf1ec7132a7ecd9f375912eca810e714e --hash=sha256:7ff61ff178250f9bb3cd89752df0f1dd0e27316a8bd1465351652b1b4a4cdfd3 --hash=sha256:833e1551925ed51e6b44c800e71e77dacd7e49181fdc9ac9a0bf3714d515785d --hash=sha256:eb6ea6da4c787111adf40f697b4e58732ee0942b5d3bd8f435277643329ba627 --hash=sha256:166eac03e48784a6a6e0e5f041cfebb1ab400b394db188c48b3a84737f505b67 --hash=sha256:17ff94e7a83aa8671a25bf5b59326ec26da379ace2ebc4411d690d80a7fbcf23 --hash=sha256:f276df9830dba7a333544bd41070e8175762a7ac20350786b322b714b0e654f5 --hash=sha256:21915eb821a6b3d9d8eefdaf57d6c345b970ad722f856cd71739493ce003ad08 --hash=sha256:9633b3034d3d901f0a46b7939f8c4d64427dfba6bbc5a36b1a67364cf148a1b0 --hash=sha256:40b951f601af999a8bf2ce8c71e8aaa4e8c6f78ff8afae7b808aae2dc50d4c40 --hash=sha256:aa5b467f15e78b82257319aebc78dd2915e4c1436c3c0d1ad6f53e47ba6e2713 --hash=sha256:ec8c433b3ab0419100bd45b47c9c8551248a5aee30ca5e9d399a0b57ac04651b --hash=sha256:7227b47e73dedaa513cdebb98469705ef0d66eb5a1250144468e9c3097d6b59b --hash=sha256:eff9d20417ff9dcb0d25e2defc2574d10b491bf2e693b4e491914738b7908168 --hash=sha256:f9d29ca8a77117315101425ec7ec2a47a22ccf59f5593378fc4077ac5b754fce --hash=sha256:8d2f1fb53a421b410751887eb4ff21386d119ef9cde3797bf5e7ed49fb51a3b3 --hash=sha256:9f3cba480d3deb69f6ee2c1825060177a22c7826431458c697df88e6aeb3caee --hash=sha256:b1692f7d6bc45e3200844be0dba153612103db241691088626a33ff1f24a0d88 --hash=sha256:14d4f3cd4e8b524ae9b8aa567858beed70c392fdec26dbdb0a8a418392e71708 --hash=sha256:be5f425ff1f5f4b3c1e33ad64ab994eed12fc284a6ea71c5243fd564502ecbe5 --hash=sha256:f3acda1924472472ddd60c29e5b9db0cec629fbe3c5c5accb74d6d6d14773478 --hash=sha256:572e1787d1460da79590bf44304abbc0a2da944ea64ec549188fa84d89bba7ab --hash=sha256:abb7a75ed8b968f3061327c433a0fbd17b729947b400747c334a9c29a9af6c58 --hash=sha256:903bbd302a2378f984aef528f76d4c9b1748f318fe1294961c072bdc7f2ffa3e --hash=sha256:013d61294b6cd8fe3242932c1c5e36e5d1db2c8afb58606c5a67efce62c1f5fd --hash=sha256:aec52725173bd3a7b56fe91bc56eccb26fbdff1386ef123abb63c84c5b43b63a --hash=sha256:97e5306482182170ade15c4b0d8386ded995a07d7cc2ca8f27958d34d6736497 --hash=sha256:00e44c8afdbe5467e4f7b5851be223be68adb4272f44696ee71fe46b7036a711 --hash=sha256:93f81b134a165cc17123626ab8da2e30c0455441d4ab5576eed73a64c025b25c --hash=sha256:b11548073a2213d950c3f671aa88e6f83cda6e2fb97a8b6317b1b5b33d850e06 --hash=sha256:288c6a76705dc54fba69fbcb59904ae4ad768b4c768839b8ca5fdadec6dd8cfd! Will try again.
An error occurred while installing gunicorn==20.1.0 --hash=sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8 --hash=sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e! Will try again.
An error occurred while installing idna==3.3; python_version >= '3.5' --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff --hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d! Will try again.
An error occurred while installing itsdangerous==2.0.1; python_version >= '3.6' --hash=sha256:9e724d68fc22902a1435351f84c3fb8623f303fffcc566a4cb952df8c572cff0 --hash=sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c! Will try again.
An error occurred while installing jinja2==3.0.2; python_version >= '3.6' --hash=sha256:8569982d3f0889eed11dd620c706d39b60c36d6d25843961f33f77fb6bc6b20c --hash=sha256:827a0e32839ab1600d4eb1c4c33ec5a8edfbc5cb42dafa13b81f182f97784b45! Will try again.
An error occurred while installing mako==1.1.5; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' --hash=sha256:169fa52af22a91900d852e937400e79f535496191c63712e3b9fda5a9bed6fc3 --hash=sha256:6804ee66a7f6a6416910463b00d76a7b25194cd27f1918500c5bd7be2a088a23! Will try again.
An error occurred while installing markupsafe==2.0.1; python_version >= '3.6' --hash=sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b --hash=sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134 --hash=sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28 --hash=sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724 --hash=sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6 --hash=sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8 --hash=sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51 --hash=sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864 --hash=sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1 --hash=sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac --hash=sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2 --hash=sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f --hash=sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53 --hash=sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64 --hash=sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509 --hash=sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135 --hash=sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18 --hash=sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567 --hash=sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85 --hash=sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d --hash=sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b --hash=sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833 --hash=sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d --hash=sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8 --hash=sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c --hash=sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75 --hash=sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26 --hash=sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d --hash=sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f --hash=sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a --hash=sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914 --hash=sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb --hash=sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a --hash=sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff --hash=sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6 --hash=sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b --hash=sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94 --hash=sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad --hash=sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145 --hash=sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646 --hash=sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066 --hash=sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7 --hash=sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872 --hash=sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6 --hash=sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f --hash=sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415 --hash=sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9 --hash=sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5 --hash=sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902 --hash=sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74 --hash=sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38 --hash=sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9 --hash=sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298 --hash=sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35! Will try again.
An error occurred while installing mysqlclient==2.0.3 --hash=sha256:fc575093cf81b6605bed84653e48b277318b880dc9becf42dd47fa11ffd3e2b6 --hash=sha256:0ac0dd759c4ca02c35a9fedc24bc982cf75171651e8187c2495ec957a87dfff7 --hash=sha256:3381ca1a4f37ff1155fcfde20836b46416d66531add8843f6aa6d968982731c3 --hash=sha256:f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 --hash=sha256:71c4b330cf2313bbda0307fc858cc9055e64493ba9bf28454d25cf8b3ee8d7f5! Will try again.
An error occurred while installing passlib==1.7.4 --hash=sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1 --hash=sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04! Will try again.
An error occurred while installing pycryptodome==3.11.0 --hash=sha256:ed45ef92d21db33685b789de2c015e9d9a18a74760a8df1fc152faee88cdf741 --hash=sha256:b33c9b3d1327d821e28e9cc3a6512c14f8b17570ddb4cfb9a52247ed0fcc5d8b --hash=sha256:b59bf823cfafde8ef1105d8984f26d1694dff165adb7198b12e3e068d7999b15 --hash=sha256:06162fcfed2f9deee8383fd59eaeabc7b7ffc3af50d3fad4000032deb8f700b0 --hash=sha256:f19edd42368e9057c39492947bb99570dc927123e210008f2af7cf9b505c6892 --hash=sha256:3c7ed5b07274535979c730daf5817db5e983ea80b04c22579eee8da4ca3ae4f8 --hash=sha256:ffd0cac13ff41f2d15ed39dc6ba1d2ad88dd2905d656c33d8235852f5d6151fd --hash=sha256:428096bbf7a77e207f418dfd4d7c284df8ade81d2dc80f010e92753a3e406ad0 --hash=sha256:d7e5f6f692421e5219aa3b545eb0cffd832cd589a4b9dcd4a5eb4260e2c0d68a --hash=sha256:4169ed515742425ff21e4bd3fabbb6994ffb64434472fb72230019bdfa36b939 --hash=sha256:4ce6b09547bf2c7cede3a017f79502eaed3e819c13cdb3cb357aea1b004e4cc6 --hash=sha256:014c758af7fa38cab85b357a496b76f4fc9dda1f731eb28358d66fef7ad4a3e1 --hash=sha256:6db1f9fa1f52226621905f004278ce7bd90c8f5363ffd5d7ab3755363d98549a --hash=sha256:621a90147a5e255fdc2a0fec2d56626b76b5d72ea9e60164c9a5a8976d45b0c9 --hash=sha256:ce81b9c6aaa0f920e2ab05eb2b9f4ccd102e3016b2f37125593b16a83a4b0cc2 --hash=sha256:53989477044be41fa4a63da09d5038c2a34b2f4554cfea2e3933b17186ee9e19 --hash=sha256:0ca7a6b4fc1f9fafe990b95c8cda89099797e2cfbf40e55607f2f2f5a3355dcb --hash=sha256:a843350d08c3d22f6c09c2f17f020d8dcfa59496165d7425a3fba0045543dda7 --hash=sha256:7ff701fc283412e651eaab4319b3cd4eaa0827e94569cd37ee9075d5c05fe655 --hash=sha256:f9bad2220b80b4ed74f089db012ab5ab5419143a33fad6c8aedcc2a9341eac70 --hash=sha256:ead516e03dfe062aefeafe4a29445a6449b0fc43bc8cb30194b2754917a63798 --hash=sha256:bc3c61ff92efdcc14af4a7b81da71d849c9acee51d8fd8ac9841a7620140d6c6 --hash=sha256:ae31cb874f6f0cedbed457c6374e7e54d7ed45c1a4e11a65a9c80968da90a650 --hash=sha256:2a4bcc8a9977fee0979079cd33a9e9f0d3ddba5660d35ffe874cf84f1dd399d2 --hash=sha256:ae29fcd56152f417bfba50a36a56a7a5f9fb74ff80bab98704cac704de6568ab --hash=sha256:fce7e22d96030b35345637c563246c24d4513bd3b413e1c40293114837ab8912 --hash=sha256:6eda8a3157c91ba60b26a07bedd6c44ab8bda6cd79b6b5ea9744ba62c39b7b1e --hash=sha256:da796e9221dda61a0019d01742337eb8a322de8598b678a4344ca0a436380315 --hash=sha256:8f3a60926be78422e662b0d0b18351b426ce27657101c8a50bad80300de6a701 --hash=sha256:75e78360d1dd6d02eb288fd8275bb4d147d6e3f5337935c096d11dba1fa84748! Will try again.
An error occurred while installing pymysql==1.0.2 --hash=sha256:816927a350f38d56072aeca5dfb10221fe1dc653745853d30a216637f5d7ad36 --hash=sha256:41fc3a0c5013d5f039639442321185532e3e2c8924687abe6537de157d403641! Will try again.
An error occurred while installing python-dotenv==0.19.1 --hash=sha256:14f8185cc8d494662683e6914addcb7e95374771e707601dfc70166946b4c4b8 --hash=sha256:bbd3da593fc49c249397cbfbcc449cf36cb02e75afc8157fcc6a81df6fb7750a! Will try again.
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 28/28 — 00:00:13
An error occurred while installing six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254! Will try again.
An error occurred while installing sqlalchemy==1.4.25; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' --hash=sha256:a79abdb404d9256afb8aeaa0d3a4bc7d3b6d8b66103d8b0f2f91febd3909976e --hash=sha256:1ebd69365717becaa1b618220a3df97f7c08aa68e759491de516d1c3667bba54 --hash=sha256:26b0cd2d5c7ea96d3230cb20acac3d89de3b593339c1447b4d64bfcf4eac1110 --hash=sha256:a505ecc0642f52e7c65afb02cc6181377d833b7df0994ecde15943b18d0fa89c --hash=sha256:6400b22e4e41cc27623a9a75630b7719579cd9a3a2027bcf16ad5aaa9a7806c0 --hash=sha256:9ebe49c3960aa2219292ea2e5df6acdc425fc828f2f3d50b4cfae1692bcb5f02 --hash=sha256:7ad59e2e16578b6c1a2873e4888134112365605b08a6067dd91e899e026efa1c --hash=sha256:33a1e86abad782e90976de36150d910748b58e02cd7d35680d441f9a76806c18 --hash=sha256:9a1df8c93a0dd9cef0839917f0c6c49f46c75810cf8852be49884da4a7de3c59 --hash=sha256:a36ea43919e51b0de0c0bc52bcfdad7683f6ea9fb81b340cdabb9df0e045e0f7 --hash=sha256:6b602e3351f59f3999e9fb8b87e5b95cb2faab6a6ecdb482382ac6fdfbee5266 --hash=sha256:a28fe28c359835f3be20c89efd517b35e8f97dbb2ca09c6cf0d9ac07f62d7ef6 --hash=sha256:08d9396a2a38e672133266b31ed39b2b1f2b5ec712b5bff5e08033970563316a --hash=sha256:1adf3d25e2e33afbcd48cfad8076f9378793be43e7fec3e4334306cac6bec138 --hash=sha256:7b7778a205f956755e05721eebf9f11a6ac18b2409bff5db53ce5fe7ede79831 --hash=sha256:842c49dd584aedd75c2ee05f6c950730c3ffcddd21c5824ed0f820808387e1e3 --hash=sha256:c211e8ec81522ce87b0b39f0cf0712c998d4305a030459a0e115a2b3dc71598f --hash=sha256:75cd5d48389a7635393ff5a9214b90695c06b3d74912109c3b00ce7392b69c6c --hash=sha256:91cd87d1de0111eaca11ccc3d31af441c753fa2bc22df72e5009cfb0a1af5b03 --hash=sha256:6003771ea597346ab1e97f2f58405c6cacbf6a308af3d28a9201a643c0ac7bb3 --hash=sha256:16ef07e102d2d4f974ba9b0d4ac46345a411ad20ad988b3654d59ff08e553b1c --hash=sha256:41a916d815a3a23cb7fff8d11ad0c9b93369ac074e91e428075e088fe57d5358 --hash=sha256:e93978993a2ad0af43f132be3ea8805f56b2f2cd223403ec28d3e7d5c6d39ed1 --hash=sha256:2ed67aae8cde4d32aacbdba4f7f38183d14443b714498eada5e5a7a37769c0b7 --hash=sha256:e37621b37c73b034997b5116678862f38ee70e5a054821c7b19d0e55df270dec --hash=sha256:90fe429285b171bcc252e21515703bdc2a4721008d1f13aa5b7150336f8a8493 --hash=sha256:dd4ed12a775f2cde4519f4267d3601990a97d8ecde5c944ab06bfd6e8e8ea177 --hash=sha256:1b38db2417b9f7005d6ceba7ce2a526bf10e3f6f635c0f163e6ed6a42b5b62b2 --hash=sha256:0b08a53e40b34205acfeb5328b832f44437956d673a6c09fce55c66ab0e54916 --hash=sha256:0566a6e90951590c0307c75f9176597c88ef4be2724958ca1d28e8ae05ec8822! Will try again.
An error occurred while installing werkzeug==2.0.2 --hash=sha256:aa2bb6fc8dee8d6c504c0ac1e7f5f7dc5810a9903e793b6f715a9f015bdadb9a --hash=sha256:63d3dc1cf60e7b7e35e97fa9861f7397283b75d765afcaefd993d6046899de8f! Will try again.
An error occurred while installing wtforms[email]==2.3.3 --hash=sha256:81195de0ac94fbc8368abbaf9197b88c4f3ffd6c2719b5bf5fc9da744f3d829c --hash=sha256:7b504fc724d0d1d4d5d5c114e778ec88c37ea53144683e084215eed5155ada4c! Will try again.
Installing initially failed dependencies...
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 253, in install
[InstallError]:       site_packages=state.site_packages
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 2063, in do_install
[InstallError]:       keep_outdated=keep_outdated
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 1312, in do_init
[InstallError]:       pypi_mirror=pypi_mirror,
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 900, in do_install_dependencies
[InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 796, in batch_install
[InstallError]:       _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 703, in _cleanup_procs
[InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/bin/pip", line 5, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.main import main
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.autocompletion import autocomplete
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.main_parser import create_main_parser
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli import cmdoptions
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.parser import ConfigOptionParser
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.configuration import Configuration, ConfigurationError
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/configuration.py", line 26, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.utils.logging import getLogger
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 13, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.utils.misc import ensure_dir
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 40, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.locations import get_major_minor_version, site_packages, user_site
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
[pipenv.exceptions.InstallError]:     from . import _distutils, _sysconfig
[pipenv.exceptions.InstallError]:   File "/home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
[pipenv.exceptions.InstallError]:     from distutils.cmd import Command as DistutilsCommand
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'distutils.cmd'
ERROR: Couldn't install package: alembic
 Package installation failed...
  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 7/28 — 00:00:11
/usr/lib/python3.6/subprocess.py:786: ResourceWarning: subprocess 10622 is still running
  ResourceWarning, source=self)
sys:1: ResourceWarning: unclosed file <_io.FileIO name=6 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.FileIO name=7 mode='rb' closefd=True>
/usr/lib/python3.6/subprocess.py:786: ResourceWarning: subprocess 10626 is still running
  ResourceWarning, source=self)
sys:1: ResourceWarning: unclosed file <_io.FileIO name=10 mode='wb' closefd=True>
sys:1: ResourceWarning: unclosed file <_io.FileIO name=11 mode='rb' closefd=True>

distutils

用「pipenv install ubuntu 18.04 distutils.sysconfig」搜尋到 Broken with Python 3 and Ubuntu 18.04,會出現「ModuleNotFoundError: No module named 'distutils.sysconfig'」似乎是 ubuntu 18.04 的 bug,有些 python 內建的模組消失了。按照建議執行了 sudo apt-get install python3-distutils,然後再嘗試一次 pipenv install。還是一樣的「ModuleNotFoundError: No module named 'distutils.sysconfig'」

用「distutils python ubuntu 18.04」搜尋到 how to install python distutils,有人建議,如果 sudo apt-get install python3-distutils 沒有用的話,可以用這個:sudo apt-get install python-distutils-extra。然後再嘗試一次 pipenv install。還是一樣的「ModuleNotFoundError: No module named 'distutils.sysconfig'」

sudo apt-get install python3-distutils-extra 也沒有用

然後我發現,distutils 其實有安裝了,但是安裝的位置是在 python3.6,我這個專案用的卻是 python3.9.7

>>> from distutils import sysconfig
>>> print(sysconfig)
<module 'distutils.sysconfig' from '/usr/lib/python3.6/distutils/sysconfig.py'>

根據 ImportError: cannot import name 'sysconfig' from 'distutils',要用這個指令 sudo apt install python3.9-distutils。然後再嘗試一次 pipenv install,終於有進展了!

*******@*******:~/shop_platform$ pipenv install
Installing dependencies from Pipfile.lock (39fa9f)...
An error occurred while installing mysqlclient==2.0.3 --hash=sha256:f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 --hash=sha256:fc575093cf81b6605bed84653e48b277318b880dc9becf42dd47fa11ffd3e2b6 --hash=sha256:3381ca1a4f37ff1155fcfde20836b46416d66531add8843f6aa6d968982731c3 --hash=sha256:0ac0dd759c4ca02c35a9fedc24bc982cf75171651e8187c2495ec957a87dfff7 --hash=sha256:71c4b330cf2313bbda0307fc858cc9055e64493ba9bf28454d25cf8b3ee8d7f5! Will try again.
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 28/28 — 00:00:52
Installing initially failed dependencies...
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 253, in install
[InstallError]:       site_packages=state.site_packages
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 2063, in do_install
[InstallError]:       keep_outdated=keep_outdated
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 1312, in do_init
[InstallError]:       pypi_mirror=pypi_mirror,
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 900, in do_install_dependencies
[InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 796, in batch_install
[InstallError]:       _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]:   File "/home/flora/.local/lib/python3.6/site-packages/pipenv/core.py", line 703, in _cleanup_procs
[InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Collecting mysqlclient==2.0.3
[pipenv.exceptions.InstallError]:   Using cached mysqlclient-2.0.3.tar.gz (88 kB)
[pipenv.exceptions.InstallError]:   Preparing metadata (setup.py): started
[pipenv.exceptions.InstallError]:   Preparing metadata (setup.py): finished with status 'error'
[pipenv.exceptions.InstallError]:   ERROR: Command errored out with exit status 1:
[pipenv.exceptions.InstallError]:    command: /home/flora/.local/share/virtualenvs/shop_platform-FMh0LNFM/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ge_2cfqu
[pipenv.exceptions.InstallError]:        cwd: /tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/
[pipenv.exceptions.InstallError]:   Complete output (15 lines):
[pipenv.exceptions.InstallError]:   mysql_config --version
[pipenv.exceptions.InstallError]:   /bin/sh: 1: mysql_config: not found
[pipenv.exceptions.InstallError]:   mariadb_config --version
[pipenv.exceptions.InstallError]:   /bin/sh: 1: mariadb_config: not found
[pipenv.exceptions.InstallError]:   mysql_config --libs
[pipenv.exceptions.InstallError]:   /bin/sh: 1: mysql_config: not found
[pipenv.exceptions.InstallError]:   Traceback (most recent call last):
[pipenv.exceptions.InstallError]:     File "<string>", line 1, in <module>
[pipenv.exceptions.InstallError]:     File "/tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/setup.py", line 15, in <module>
[pipenv.exceptions.InstallError]:       metadata, options = get_config()
[pipenv.exceptions.InstallError]:     File "/tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/setup_posix.py", line 70, in get_config
[pipenv.exceptions.InstallError]:       libs = mysql_config("libs")
[pipenv.exceptions.InstallError]:     File "/tmp/pip-install-zik0gyxw/mysqlclient_3641a1646ca5444f936ba0ee4ff7be81/setup_posix.py", line 31, in mysql_config
[pipenv.exceptions.InstallError]:       raise OSError("{} not found".format(_mysql_config_path))
[pipenv.exceptions.InstallError]:   OSError: mysql_config not found
[pipenv.exceptions.InstallError]:   ----------------------------------------
[pipenv.exceptions.InstallError]: WARNING: Discarding https://files.pythonhosted.org/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz#sha256=f6ebea7c008f155baeefe16c56cd3ee6239f7a5a9ae42396c2f1860f08a7c432 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement mysqlclient==2.0.3 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0rc1)
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for mysqlclient==2.0.3
ERROR: Couldn't install package: mysqlclient
 Package installation failed...
  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/1 — 00:00:12

不過 mysqlclient 這個套件沒有成功安裝

mysqlclient

用「mysqlclient python3.9 ubuntu」搜尋到 Error installing mysqlclient for python on Ubuntu 18.04。按照建議執行了 sudo apt-get install libssl-dev,然後再嘗試一次 pipenv install。還是一樣「Couldn't install package: mysqlclient」。sudo apt-get install python3.9-dev 也沒用。sudo apt-get install default-libmysqlclient-dev 成啦!

撰寫 .env 檔

touch .env
nano .env

Comments

Popular posts from this blog

Alpha Camp 全端開發課程學習心得

在 javascript 用 regular expression 為金額加上千位數分隔符號

shop_platform - sqlalchemy.exc.TimeoutError