在尝试部署我的django项目时,我遇到了一个奇怪的错误:
有一个我没有使用的依赖项,并且已经卸载,在构建期间仍然试图加载requirements.txt
。
我已经卸载了所有的依赖,从requirements.txt
中删除了它,运行makemigrations
和migrate
,但它仍然试图加载它,这导致部署崩溃。
PyGObject
为依赖项。
工作流:Procfile -web: gunicorn solarsystem.wsgi
ran -pip3 freeze > requirements.txt
卸载后,该依赖项不再显示。
然而在构建时:
Collecting PyGObject
remote: Downloading PyGObject-3.42.0.tar.gz (716 kB)
remote: Installing build dependencies: started
remote: Installing build dependencies: finished with status 'done'
remote: Getting requirements to build wheel: started
remote: Getting requirements to build wheel: finished with status 'done'
remote: Preparing wheel metadata: started
remote: Preparing wheel metadata: finished with status 'done'
...
ERROR: Failed building wheel for PyGObject
...
ERROR: Could not build wheels for PyGObject which use PEP 517 and cannot be installed directly
这是我的requirements.txt
:
asgiref==3.3.4
autopep8==1.5.7
boto3==1.17.108
botocore==1.20.108
click==8.0.1
cm-rgb==0.3.6
cycler==0.10.0
dj-database-url==0.5.0
Django==3.2.3
django-appconf==1.0.4
django-compressor==2.2
django-heroku==0.3.1
django-libsass==0.9
django-material==1.9.0
django-materializecss-form==1.1.17
django-on-heroku==1.1.2
django-sass-processor==1.0.1
gunicorn==20.1.0
hidapi==0.10.1
Jinja2==3.0.1
jmespath==0.10.0
kiwisolver==1.3.1
libsass==0.21.0
MarkupSafe==2.0.1
matplotlib==3.4.3
mpld3==0.5.5
numpy==1.21.2
Pillow==8.3.1
psutil==5.8.0
psycopg2==2.9.1
psycopg2-binary==2.9.1
pycairo==1.20.1
pycodestyle==2.7.0
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
PyYAML==5.4.1
rcssmin==1.0.6
rjsmin==1.0.12
s3transfer==0.4.2
six==1.16.0
sqlparse==0.4.1
toml==0.10.2
urllib3==1.26.6
whitenoise==5.3.0
我已经尝试了requirements.txt
和Procfile
配置的多种变体,查看了我的源代码中PyGObject
或gi
的任何导入,并且没有。我还搜索了PyGObject
文档和其他堆栈溢出资源,但没有成功。
重申一下,我想以某种方式完全删除它,或者以某种方式为该依赖项添加一个ignore语句,以便我可以成功部署。
matplotlib使用PyGobject,这就是为什么当你安装require .txt文件时,它会尝试安装PyGobject。https://pygobject.readthedocs.io/en/latest/尝试使用以下命令。它可能会解决安装PyGobject
的问题。python3 -m pip install --no-use-pep517 cm-rgb
或
sudo pacman -S python cairo pkgconf gobject-introspection gtk3
pip3 install pycairo to build and install Pycairo
pip3 install PyGObject to build and install PyGObject