Comments (12)
I'm having the same exact issue as @ducoterra as well. I'm running version 1.7.0 of the extension in VS Code 1.55.0 on MacOS 10.15.7. I have verified that the virtual environment is activated, that dependencies are installed, and that the virtual environment is selected in VS Code per the instructions on the extension's detail page:
Command failed: python /Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/resources/python/checkVenv.py
Error: Command failed: python /Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/resources/python/checkVenv.py
at checkExecSyncError (child_process.js:639:11)
at Object.execSync (child_process.js:675:15)
at Object.execSync (electron/js2c/asar_bundle.js:5:12113)
at Function.isInVirtualEnv (/Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/out/main/utils/pypiUtils.js:91:18)
at Function.createDependenciesTrees (/Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/out/main/utils/pypiUtils.js:67:28)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Function.createDependenciesTrees (/Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/out/main/treeDataProviders/dependenciesTree/dependenciesTreeFactory.js:13:13)
at async /Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/out/main/treeDataProviders/dependenciesTree/dependenciesDataProvider.js:151:13
at async /Users/-----/.vscode/extensions/jfrog.jfrog-vscode-extension-1.7.0/out/main/utils/scanUtils.js:22:13
I also get a result of 0 when running checkVenv.py with the virtual environment activated and a 1 if it's not activated. If there are log files, can you tell me where to find them so I can include them here?
Running checkVenv.py through a debugger, it seems that virtualenv_prefix is being set to None and venv_prefix is being set to '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8', which is not the project's activated virtual environment. The correct virtual environment is returned by sys.prefix:
(venv) laptop:test -----$ python
Python 3.8.2 (default, Aug 25 2020, 09:23:57)
[Clang 12.0.0 (clang-1200.0.32.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.prefix)
/Users/-----/VS Code Projects/test/venv
I'm wondering if there might be a bug in isInVirtualEnv()
or getPythonPath()
in pypiUtils.ts since isInVirtualEnv()
is obviously returning a false value given the following error message:
Please install and activate a virtual environment before running Xray scan. Then, install your Python project in that environment.
from jfrog-vscode-extension.
@ducoterra
Please make sure to activate your venv as follows:
1.
2.
Please let me know if it helped.
We'd also appreciate any other feedback about the extension and its instructions.
from jfrog-vscode-extension.
That's the issue, I do have my virtual environment activated like that. The xray plugin doesn't seem to recognize it.
from jfrog-vscode-extension.
Are there logs I can provide that would help identify the issue?
from jfrog-vscode-extension.
Thanks, @ducoterra.
To figure our whether the current Python project is running under Virtualenv, we run this script in the root folder of the project:
import sys
virtualenv_prefix = getattr(sys, "real_prefix", None)
venv_prefix = getattr(sys, "base_prefix", sys.prefix)
if virtualenv_prefix or venv_prefix != sys.prefix:
exit(0)
exit(1)
For more information about this attitude, read here: https://stackoverflow.com/a/58026969/4233342
Can you please give it a try in your environment? You can try to run this as follows:
# Before activating the environment
python checkVenv.py
echo $?
# response code should be 1 because the Virtualenv is not activated
# Activate env
source venv/bin/activate
python checkVenv.py
echo $?
# response code should be 0. What do you see here?
Can you please also provide more information about your environment? This information must include your operating system, virtual environment type and version. Are you using Anaconda virtualenv?
Looking forward to your feedback!
from jfrog-vscode-extension.
Thanks for the details! Here are my specs:
OS: macOS Catalina version 10.15.7 (19H2)
Python version: 3.8.3
Virtual environment type: might need some help answering this. It's not Anaconda. I ran python3 -m venv venv
to create it.
I ran the script and got the expected output:
user@laptop project_dir % python3 checkVenv.py
user@laptop project_dir % echo $?
1
user@laptop project_dir % source venv/bin/activate
(venv) user@laptop project_dir % python3 checkVenv.py
(venv) user@laptop project_dir % echo $?
0
Appreciate the help.
from jfrog-vscode-extension.
@ducoterra,
Thanks for your inputs.
I created #75 to help investigating this issue further.
from jfrog-vscode-extension.
@ducoterra
We release JFrog VS-Code extension 1.5.2. In this version, when the extension fails to run checkVenv.py
in the virtualenv, it prints the reason to the logs.
Looking forward to your feedback!
from jfrog-vscode-extension.
I'm also running into the same issue as @rderveloy and @ducoterra.
from jfrog-vscode-extension.
me too, exactly the same behavior!
I am using pyenv with pyenv-virtualenvwrapper with Python 3.9.1
from jfrog-vscode-extension.
@mlieberman85 @rderveloy @DrackThor
Thanks for your feedback.
We currently support only Virtualenv.
However, we plan to change, in the near future, the way we calculate the Python dependencies to better interact with the vscode-python extension. This extension contains all the information we need to properly build the dependency tree in all environments. 🚀
One direction we will start to investigate soon is to contribute an API that exposes the needed information.
We'll keep you updated once a better solution will be found.
from jfrog-vscode-extension.
@ducoterra @rderveloy @mlieberman85,
JFrog VS-Code extension 1.8.5 is released! On this version we retrieve the Python executable path in a better way - see #127.
Feel free to upgrade - we'd appreciate your feedback on that.
@DrackThor - currently only Virtualenv is supported by the extension.
from jfrog-vscode-extension.
Related Issues (20)
- How to use the extension installed in vs2022? HOT 1
- Configuring when using Windows is painful and needs to be done manually - not intuitive/no tools HOT 1
- Extension causes high cpu load HOT 1
- Anaconda is not supported by VSCode extension
- VS Code extension not working with a proxy reachable via HTTP and redirecting to JFrog platform via HTTPS HOT 1
- add conan feature for C++
- Dockerfile scanning HOT 2
- Python Poetry package manager support HOT 1
- Configuration files location HOT 5
- JFrog IDE plugin scan fails on Windows due to whitespace in username HOT 1
- HTTP 401 when authenticating with token HOT 4
- [go:embed] Unable to get golang project using go:embed module to properly scan HOT 3
- extension not visible on sidebar after installation HOT 3
- Build Name Pattern not saved
- Only display violations on direct dependencies
- Improve Login Error message
- test
- Yarn 2 Support HOT 1
- Support for Gradle HOT 1
- Use a chosen terminal in VSC instead of the default OS terminal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jfrog-vscode-extension.