-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing bug executing setup.sh script in python venv #2475
base: master
Are you sure you want to change the base?
Conversation
Fixing issue when running setup.sh in venv steps to reproduce ------------------------------- 1) go to the MobSF folder 2) execute command "python -m venv venv" 3) execute command "source ./venv/bin/activate" 4) run setup.sh console output: ....... [notice] To update, run: pip install --upgrade pip ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv. [INSTALL] Installing Requirements ........ Solution: --------------- after adding a check for pip location not in /usr/lib/python the script works without any errors
You do not have to create a venv explicitly, running |
Poetry may create a virtual environment, but it also can fails, in this case poetry will try to install the package locally. my current operating system does not support --user flag for python installation. The execution of setup.sh script fails. the only option to run the script to create venv using "python -m venv venv". It is a clean built in python functionality which works perfectly. |
Are you observing any errors when running |
yes, the MobSF stop working with script deployment setup.sh und run.sh on famous penetration testing distribution blackarch. I'm supporting MobSF als part of the MPT (Mobile Penetration Toolkit) and MobSF 4.1.3 stoped working on blackarch. I'm trying to have a clear separation on supported tools, without a need to use additional tools like docker. that is why I put the time in development patch on running setup.sh on venv. So far the only check is whether the script is running on MacOS ( $unamestr == 'Darwin' ) and the additional check for venv was added ("$pip_location" != "/usr/lib/python"*) please check the following command: you have to check "/usr/lib/python" presence in the string This modification should not have any side side effects and only allows run the script properly in venv as well |
Let me test this across our OS suite and get back. |
# Check and upgrade pip | ||
if python3 -m pip -V &>/dev/null; then | ||
# Pip Check and Upgrade | ||
python3 -m pip -V |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be replaced with pip_location
?
Thanks for clarification. You are right, I removed venv and use setup.sh with poetry. Just released an new MPT version which fix the issue. Could you create a new release which include this patch? |
Fixing issue when running setup.sh in venv
steps to reproduce
console output:
.......
[notice] To update, run: pip install --upgrade pip ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv. [INSTALL] Installing Requirements
........
Solution:
after adding a check for pip location not in /usr/lib/python the script works without any errors
Describe the Pull Request
Checklist for PR
tox -e lint,test
StaticAnalyzer/tests.py
)Additional Comments (if any)