我使用 bash 文件安装了该软件包,并在 GitHub 中执行的工作流程文件中运行 bash 文件:
工作流程.yml
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: install MSIdentity
run : |
chmod +x MSIdent.sh
./MSIdent.sh
- name: Install dependencies
run: pip install -r requirements.txt
在构建过程中,我收到以下通知:
run chmod +x MSIdent.sh
chmod +x MSIdent.sh
./MSIdent.sh
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.9.16/x64
Collecting git+https://github.com/azure-samples/ms-identity-python-utilities@main
Cloning https://github.com/azure-samples/ms-identity-python-utilities (to revision main) to /tmp/pip-req-build-d_rgygaw
Running command git clone --filter=blob:none --quiet https://github.com/azure-samples/ms-identity-python-utilities /tmp/pip-req-build-d_rgygaw
Resolved https://github.com/azure-samples/ms-identity-python-utilities to commit 9b32cef36c6c0b73c1b3237fdd66128d89f90a62
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting msal<2,>=1.6.0
Downloading msal-1.21.0-py2.py3-none-any.whl (89 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.9/89.9 kB 2.1 MB/s eta 0:00:00
Collecting cryptography<41,>=0.6
Downloading cryptography-40.0.2-cp36-abi3-manylinux_2_28_x86_64.whl (3.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.7/3.7 MB 44.4 MB/s eta 0:00:00
Collecting requests<3,>=2.0.0
Downloading requests-2.28.2-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 16.2 MB/s eta 0:00:00
Collecting PyJWT[crypto]<3,>=1.0.0
Downloading PyJWT-2.6.0-py3-none-any.whl (20 kB)
Collecting cffi>=1.12
Downloading cffi-1.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 441.2/441.2 kB 69.6 MB/s eta 0:00:00
Collecting urllib3<1.27,>=1.21.1
Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.9/140.9 kB 37.0 MB/s eta 0:00:00
Collecting idna<4,>=2.5
Downloading idna-3.4-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 16.8 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 kB 39.1 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.2/199.2 kB 43.6 MB/s eta 0:00:00
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 34.4 MB/s eta 0:00:00
Installing collected packages: urllib3, PyJWT, pycparser, idna, charset-normalizer, certifi, requests, cffi, cryptography, msal, ms-identity-web
DEPRECATION: ms-identity-web is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for ms-identity-web: started
Running setup.py install for ms-identity-web: finished with status 'done'
Successfully installed PyJWT-2.6.0 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-3.1.0 cryptography-40.0.2 idna-3.4 ms-identity-web-0.16.6 msal-1.21.0 pycparser-2.21 requests-2.28.2 urllib3-1.26.15
Notice: A new release of pip is available: 23.0.1 -> 23.1
Notice: To update, run: pip install --upgrade pip
部署也成功了。在通过 Azure 启动 Web Django 应用程序期间,我收到错误:
2023-04-16T10:55:23.072620824Z mod = importlib.import_module(self.SETTINGS_MODULE)
2023-04-16T10:55:23.072625224Z File "/opt/python/3.9.16/lib/python3.9/importlib/__init__.py", line 127, in import_module
2023-04-16T10:55:23.072629724Z return _bootstrap._gcd_import(name[level:], package, level)
2023-04-16T10:55:23.072634124Z File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2023-04-16T10:55:23.072638824Z File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2023-04-16T10:55:23.072679724Z File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2023-04-16T10:55:23.072689224Z File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2023-04-16T10:55:23.072722424Z File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2023-04-16T10:55:23.072730124Z File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2023-04-16T10:55:23.072734723Z File "/tmp/MyLongNumber/MyAppName/MyAppName/settings.py", line 15, in <module>
2023-04-16T10:55:23.072739323Z from ms_identity_web.configuration import AADConfig
2023-04-16T10:55:23.072743923Z ModuleNotFoundError: No module named 'ms_identity_web'
2023-04-16T10:55:23.084117523Z [2023-04-16 10:55:23 +0000] [97] [INFO] Worker exiting (pid: 97)
2023-04-16T10:55:23.177194902Z [2023-04-16 10:55:23 +0000] [96] [INFO] Shutting down: Master
2023-04-16T10:55:23.177231402Z [2023-04-16 10:55:23 +0000] [96] [INFO] Reason: Worker failed to boot.
我想知道这里出了什么问题,因为该软件包似乎已成功安装。我只是按照 Microsoft 教程中的说明进行操作。有没有人遇到过同样的问题并且可以帮助我?谢谢!
我根据您共享的教程链接在实验室中重现了该场景,并得到了相同的错误“ModuleNotFoundError:没有名为“ms_identity_web”的模块
这是因为应用程序所在的位置没有安装模块“ms__identity__web”,并将模块安装在临时位置。
解决问题:
导航到项目文件夹以安装项目依赖项(requirement.txt)
(djangoenv) ..... -身份验证\登录> pip install -r requests.txt
djangoenv 是运行 Django 应用程序的虚拟环境,pip install 将在应用程序运行的上述路径中安装所有依赖项。
您发布的解决方案对我有用。