Skip to content
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

Fix #2845 - LocalCommandLineCodeExecutor is not working with virtual environments #2847

Closed

Conversation

NanthagopalEswaran
Copy link
Contributor

@NanthagopalEswaran NanthagopalEswaran commented Jun 2, 2024

Why are these changes needed?

If the virtual env path is relative, local code executer fails to execute any code blocks

Related issue number

"Closes #2845"

Checks

@NanthagopalEswaran
Copy link
Contributor Author

@microsoft-github-policy-service agree

@NanthagopalEswaran NanthagopalEswaran changed the title Fix #2845 Fix #2845 - LocalCommandLineCodeExecutor is not working with virtual environments Jun 2, 2024
executor = LocalCommandLineCodeExecutor(work_dir=relative_folder_path, virtual_env_context=env_builder_context)
code_blocks = [
# https://stackoverflow.com/questions/1871549/how-to-determine-if-python-is-running-inside-a-virtualenv
CodeBlock(code="import sys; print(sys.prefix != sys.base_prefix)", language="python"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition also make sure the environment used is the same as expected?

Copy link
Contributor Author

@NanthagopalEswaran NanthagopalEswaran Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekzhu, Could you please elaborate?

Modifications that I made should work for all supported environments. Could you please review recent modifications and see if this comment is still valid?

Copy link

gitguardian bot commented Jun 10, 2024

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10404695 Triggered Generic High Entropy Secret bdda3e6 test/oai/test_utils.py View secret
10493810 Triggered Generic Password bdda3e6 notebook/agentchat_pgvector_RetrieveChat.ipynb View secret
10493810 Triggered Generic Password bdda3e6 notebook/agentchat_pgvector_RetrieveChat.ipynb View secret
11616921 Triggered Generic High Entropy Secret 5a51d20 notebook/agentchat_agentops.ipynb View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@NanthagopalEswaran
Copy link
Contributor Author

Sorry, by mistake closed

@NanthagopalEswaran
Copy link
Contributor Author

NanthagopalEswaran commented Jun 10, 2024

@sonichi, Hi, I just updated my branch with current main. now, GitGuardian showing secret found error in some other notebook which I haven't touched.

Could you help me resolve this?

And please trigger the workflow so that I can verify the fix that I made.

@NanthagopalEswaran
Copy link
Contributor Author

I am planning to reopen this as a new PR since I am seeing gitguardian issues from main branch displayed here. Hope it gets resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: LocalCommandLineCodeExecutor is not working with virtual environments
4 participants