Last active
July 21, 2022 19:21
-
-
Save AgungPambudi/399dec043cf6d1f5c83587200443fd2e to your computer and use it in GitHub Desktop.
Given the python source code directory is it possible to create requirements.txt automatically from the import section
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pip3 freeze > requirements.txt # Python3 | |
$ pip freeze > requirements.txt # Python2 | |
# if you want to list only packages used inside a virtualenv use: | |
$ source <myvenvname>/bin/activate # or in Windows cd <myenvname>\Scripts\ then type activate.bat Enter | |
$ pip freeze -l > requirements.txt | |
# install packages using pip according to the requirements.txt file from a local directory | |
$ pip install -r requirements.txt # pip install to requirements.txt | |
# Simple Python Version Management: pyenv | |
# easily switch between multiple versions of Python (https://github.com/pyenv/pyenv) | |
# virtual env menggunakan spesifik python version | |
$ virtualenv -p="C:\Python37\python.exe" "C:\Users\a c e r\Documents\crispdm-agungpambudi-prophet" | |
# python3: | |
$ pip3 install virtualenv | |
$ python3 -m venv <myenvname> | |
# python2: | |
$ pip install virtualenv | |
$ virtualenv <myenvname> | |
# "WARNING: Ignoring invalid distribution -raitlets (c:\users\a c e r\documents\crispdm-agungpambudi-prophet\lib\site-packages)" | |
# solution: | |
$ cd C:\Users\a c e r\Documents\crispdm-agungpambudi-prophet\Lib\site-packages | |
$ rm -fr "~raitlets-5.3.0.dist-info" # delete folder dengan prefix ~ | |
# https://tecadmin.net/install-python-3-7-on-ubuntu-linuxmint/ | |
$ virtualenv -p="/usr/local/bin/python3.7" "/home/user/Github/crispdm-agungpambudi-prop" | |
$ pip uninstall fbprophet pystan | |
$ pip --no-cache-dir install pystan==2.17 #any version | |
$ pip --no-cache-dir install fbprophet==0.2 #any version | |
$ pip install Cython --force | |
# menggunakan Anaconda : https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-18-04 | |
$ conda env list | |
$ conda deactivate | |
$ conda env remove -n corrupted_env # delete the Conda Environment | |
$ conda search "^python$" # lihat daftar versi python | |
# perintah dobawah ini akan menggunakan python versi 3.7.11 | |
$ conda create -n crispdm-agungpambudi-prop python=3.7.11 crispdm-agungpambudi-prop # create a virtual environment for your project | |
$ source activate crispdm-agungpambudi-prop | |
# on ubuntu : https://discuss.streamlit.io/t/pystan-issues-while-deploying-an-app-on-share-streamlit-io/23057/3 | |
scipy | |
seaborn >= 0.11.2 | |
sklearn | |
pystan == 2.19.1.1 | |
fbprophet == 0.7.1 | |
$ conda activate crispdm-agungpambudi-prop | |
$ conda install -n crispdm-agungpambudi-prop pip # install additional Python packages to a virtual environment | |
$ conda install -n crispdm-agungpambudi-prop scikit-learn | |
$ pip freeze -l > requirements.txt | |
$ source deactivate # deactivate your virtual environment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment