如何解决安装RASA依赖时tensorflow==1.12.0版本匹配错误?
Hey there, let's work through this error you're hitting while setting up your Rasa chatbot. The core issue here is that tensorflow==1.12.0 is a very old version that's no longer compatible with modern Python versions or some operating systems, and it might not be available on default PyPI mirrors anymore. Here are the most straightforward fixes:
1. Check Your Python Version Compatibility
TensorFlow 1.12.0 only supports Python 3.5, 3.6, or 3.7. If you're running Python 3.8 or newer, pip won't find this version at all.
- Run this command to check your Python version:
python --version # or python3 --version on macOS/Linux - If your version is too new, use a version manager like
pyenv(for macOS/Linux) orconda(cross-platform) to install Python 3.7, create a virtual environment with it, and try installing the dependencies again.
2. Install TensorFlow 1.12.0 via the Official PyPI Index
Sometimes, third-party PyPI mirrors might not keep old package versions. Try installing directly from the official index:
pip install tensorflow==1.12.0 --index-url https://pypi.org/simple/
If you're on Windows, double-check that you're using a 64-bit Python installation—TensorFlow 1.x doesn't support 32-bit systems.
3. Use a More Compatible TensorFlow 1.x Version
If you can't get 1.12.0 to install, consider upgrading to TensorFlow 1.15.0 (the last stable release of TensorFlow 1.x). It supports newer Python versions (up to 3.7) and is fully compatible with older Rasa versions that require TensorFlow 1.x.
- Edit your
requirements.txtfile, change the linetensorflow==1.12.0totensorflow==1.15.0 - Then run the installation command again:
pip install -r requirements.txt
4. Ensure You're Using a Virtual Environment
Global Python environments often have conflicting packages that can cause installation issues. Create and activate a virtual environment first:
# For venv (built-in) python3 -m venv rasa_env source rasa_env/bin/activate # macOS/Linux # Or on Windows: rasa_env\Scripts\activate # Then install dependencies pip install -r requirements.txt
内容的提问来源于stack exchange,提问作者Prachi Bafna

