请求协助解决libgfortran.so.4缺失及Python模块导入报错问题
Hey there, let's work through these two errors you're facing—they're both fixable, so let's take them one at a time!
This error means your system (or conda environment) is missing the GNU Fortran runtime library version 4. Here's how to install it based on your setup:
- Debian/Ubuntu-based systems: Run this command in your terminal to install the system package:
sudo apt-get update && sudo apt-get install libgfortran4 - CentOS/RHEL-based systems: Use yum to grab the correct package:
sudo yum install libgfortran.x86_64 - Conda environment (your case, since you're using Anaconda): Install the library directly into your
testing-envto avoid system-level conflicts:conda activate testing-env conda install libgfortran=4
import tracking failure) The second error points to a missing or broken tracking module within your lda2vec installation. This usually happens when the package wasn't installed correctly, or dependencies are missing. Let's fix this:
First, ensure core dependencies are installed in your conda env:
lda2vec relies on numpy, scipy, and TensorFlow (note: Python 2.7 only supports TensorFlow 1.x versions). Run these commands:conda activate testing-env conda install numpy scipy tensorflow=1.15Reinstall lda2vec from source (more reliable than pip):
The pip version of lda2vec might be incomplete for Python 2.7. Clone the official repo and install it locally:git clone https://github.com/cemoody/lda2vec.git cd lda2vec python setup.py installThis ensures all modules (including
tracking) are properly placed in your environment's site-packages.Double-check the module exists:
After reinstalling, verify thetracking.pyfile is present at/home/tamouze/anaconda2/envs/testing-env/lib/python2.7/site-packages/lda2vec/. If it's still missing, try deleting the existing lda2vec folder in site-packages and reinstalling from source again.
A quick side note: Python 2.7 is no longer supported, so you might run into more compatibility issues down the line. If possible, consider migrating to Python 3.6+ (lda2vec works with newer Python versions too!) to avoid future headaches.
Hope these steps get your lda2vec script up and running! Let me know if you run into any other issues.
内容的提问来源于stack exchange,提问作者bib

