Search code examples
pythonpippackage

Installing python packages using requirements.txt file


i'm trying to install some packages from python using a requirements.txt file and some execute until i run into this error

Collecting numpy
  Using cached numpy-1.24.1-cp311-cp311-win_amd64.whl (14.8 MB)
Collecting nltk
  Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
Collecting gensim
  Using cached gensim-4.3.0-cp311-cp311-win_amd64.whl (24.0 MB)
Collecting scikit-learn
  Using cached scikit_learn-1.2.0-cp311-cp311-win_amd64.whl (8.2 MB)
Collecting PyDictionary
  Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting fuzzywuzzy
  Using cached fuzzywuzzy-0.18.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: beautifulsoup4 in c:\users\administrator\plagcheker\.plagenv\lib\site-packages (from -r requirements.txt (line 7)) (4.11.1)
Collecting python-Levenshtein
  Using cached python_Levenshtein-0.20.9-py3-none-any.whl (9.4 kB)
Collecting pandas
  Using cached pandas-1.5.2-cp311-cp311-win_amd64.whl (10.3 MB)
Collecting py-stringmatching
  Using cached py_stringmatching-0.4.2.tar.gz (661 kB)
  Preparing metadata (setup.py) ... done
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter

my requirements.txt has:

 nltk
 gensim
 scikit-learn
 PyDictionary
 fuzzywuzzy
 beautifulsoup4
 python-Levenshtein
 pandas
 py-stringmatching
 tkinter
 python-docx

What could be the issue?


Solution

  • First - tkinter should be already installed on your Python if you have Windows or MacOS Info here

    Second - for debian and linux - Tkinter isn't distributed through pip; if it didn't come pre-packaged with Python, you have to get it from elsewhere

    For Python 3:

    sudo apt-get install python3-tk 
    

    For Python 2.7

    sudo apt-get install python-tk
    

    As you can see names aren't equal to 'tkinter' so change it to your version
    It'll work only if you are using yum

    yum install tkinter
    

    P.S. If for some reason you don't have it on MAC you can use commands for Debian and Linux in other syntax:

    brew install python-tk
    

    Name, as you can see, is still not 'tkinter'. You can change it in your 'requirements.txt' file if your .exe doesn't use pip