setup.py installs the package in whichever environment is active. If you want to install it in a virtualenv, then you need to activate it first. Otherwise it will install globally.
You can continue using requirements.txt but let setup.py handle the installation. You can then read the file and set the list of dependencies for install_requires section.
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = f.readlines()
setup(
name='myawesomepackage',
version='0.1',
packages=find_packages(),
url='https://example.com',
author='abdusco',
description='',
install_requires=requirements,
entry_points=dict(console_scripts=[
'myawesomeapp=app:main'
])
)
Here's requirements.txt
certifi==2019.3.9
chardet==3.0.4
Click==7.0
idna==2.8
requests==2.22.0
urllib3==1.25.3