Created With

link實習日誌 20230302

link09:00 環境建置

紀錄上週五下班前遇到的問題。參考 Installing Packages 的說明,執行安裝所有套件的指令

1linkpython -m pip install -r requirements.txt

再用一次執行專案的指令

1linkpython infer.py --image_dir "photo.png"

結果出現

1linkModuleNotFoundError: No module named 'torch'

link10:00 再試一次

導師傳來訊息"我記得第一個專案需要的環境是python 3.7",我回覆"我有裝最新版的 python 3.11"。

再用一次安裝所有套件的指令,出現

1linkERROR: Ignored the following versions that require a different python version: 1.21.2

2linkRequires-Python >=3.7,<3.11;

3link...

4linkERROR: Could not find a version that satisfies the requirement numpy==1.21.5

5link(from versions: 1.3.0,

6link...

7linkERROR: No matching distribution found for numpy==1.21.5

總而言之想要安裝 numpy 1.21.5 就不能用 Python 3.11。

link11:00 安裝舊版

安裝 Python 3.10,修改環境變數的路徑。重新開啟 VSCode,檢查 Python 版本,成功切換到 Python 3.10。

1link> python --version

2linkPython 3.10.10

link12:00 午餐


link13:00 回到家裡

再用一次安裝所有套件的指令,成功安裝 numpy,又出現沒辦法用 torch 的錯誤訊息

1linkERROR: Could not find a version that satisfies the requirement torch==1.10.2

2link(from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1)

3linkERROR: No matching distribution found for torch==1.10.2

我不懂為何不能安裝,於是去查 torch 1.10.2 的資料,左邊有寫 Requires: Python >=3.6.2。我現在是用 Python 3.10.10。

嘗試只安裝 torch 1.10.2

1linkpython -m pip install torch==1.10.2

出現和上面一樣的錯誤訊息。

嘗試把 Requirement.txt 當中的 torch==1.10.2 改成 torch==1.11.0,再用一次安裝所有套件的指令。

成功安裝 torch,出現沒辦法用 torchvision 的錯誤訊息

1linkERROR: Could not find a version that satisfies the requirement torchvision==0.11.3

2link(from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2,

3link0.2.2.post2, 0.2.2.post3, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1)

4linkERROR: No matching distribution found for torchvision==0.11.3

嘗試把 Requirement.txt 當中的 torchvision==0.11.3 改成 torchvision==0.12.0,再用一次安裝所有套件的指令。出現 future 套件有狀況的錯誤訊息。

link15:00 路徑錯誤

再試一次執行專案的指令,出現兩個錯誤。

第一個錯誤訊息是

1linkUserWarning: Failed to initialize NumPy:

2linkmodule compiled against API version 0xf but this version of numpy is 0xe

3link(Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.)

拿整段錯誤訊息去搜尋,找到這篇討論串

目前的 numpy 版本是 1.21.5,安裝 1.22.0

1linkpython -m pip install numpy==1.22.0

第二個錯誤訊息是

1linkNotADirectoryError: [WinError 267] 目錄名稱無效。: 'photo.png'

拿整段錯誤訊息去搜尋,找到 how to solve NotADirectoryError?,以我的資料夾路徑為例,要改用以下指令才能運作

1linkpython infer.py --image_dir "C:\xampp\htdocs\AreteInternship\Fast-AgingGAN\images"

再試一次執行專案的指令,出現新的錯誤訊息

1linkIndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

link16:30 先去買菜

買了咖哩塊、雞胸肉、白米、油麵、衛生紙。

link17:00 繼續研究

根據錯誤訊息,問題是出在 infer.py 的第 39 行,可是這是別人寫的程式碼,我又不能亂改,那我現在到底應該怎麼處理才好?

傳訊息給導師"今天嘗試執行檔案遇到很多問題,明天再繼續,我先下班了,謝謝"。導師回覆"謝謝,辛苦了"。

link18:00 下班

link本日心得

沒想到會遇到這麼多問題。

實習日誌 2023030209:00 環境建置10:00 再試一次11:00 安裝舊版12:00 午餐13:00 回到家裡15:00 路徑錯誤16:30 先去買菜17:00 繼續研究18:00 下班本日心得

Home

得到機會chevron_right

實習日誌chevron_right
202211 日誌chevron_right
202212 日誌chevron_right
202301 日誌chevron_right
202302 日誌chevron_right
202303 日誌chevron_right
202304 日誌chevron_right

任務成果chevron_right
任務清單chevron_right

實習結束chevron_right

返回個人網站