jinsanity07git / jinsanity07git.github.io Goto Github PK
View Code? Open in Web Editor NEWblog
blog
When attempting to activate a Conda environment using PowerShell in Visual Studio Code and noticing it doesn't work as expected, there are a few common issues and solutions to consider. Here’s what you might need to check and how to address each possibility:
If Conda commands don’t work directly in PowerShell, it could be because Conda hasn’t been properly initialized for use with PowerShell. Conda needs to be initialized in each shell type you want to use it with.
To initialize Conda for PowerShell, you can run the following command in a PowerShell window that has administrative privileges:
conda init powershell
This command sets up the proper hooks for Conda in PowerShell, allowing the conda
command and environments to be managed directly from within PowerShell.
If initialization doesn’t seem to be the issue, ensure that the path to the Conda executable is correctly included in your system's PATH environment variable. Sometimes, especially if you installed Anaconda or Miniconda for just the current user, it might not have updated the system PATH automatically.
You can check your PATH variable in PowerShell like this:
$env:PATH
Look for a path that includes your Conda installation (typically something like C:\Users\sanity\miniconda3\
or C:\Users\sanity\Anaconda3\
). If it’s missing:
Add it manually via System Properties > Environment Variables, or
Use PowerShell to add it temporarily:
$env:PATH += ";C:\Users\sanity\miniconda3\"
Replace C:\Users\sanity\miniconda3\
with the path to your actual Conda installation.
After making changes like initializing Conda for PowerShell or updating environment variables, it’s a good idea to restart Visual Studio Code. This ensures that VS Code and its integrated terminal sessions pick up all the changes.
Make sure that the Conda environment tdm23_env_1
indeed exists. You can verify this by listing all available Conda environments:
conda env list
This will show all the environments and their paths, confirming whether tdm23_env_1
is correctly installed and recognized.
Sometimes, PowerShell’s execution policy can prevent scripts from running, which might include some of Conda’s initialization scripts. To see your current execution policy, use:
Get-ExecutionPolicy
If it’s set to Restricted
, you might want to change it to RemoteSigned
to allow locally created scripts to run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
In some cases, running conda activate
directly in the script or command line interface mode in PowerShell might not work due to how Conda manages changes to the shell environment. Using:
conda activate
might require following it with an interactive script or opening a new PowerShell session.
By checking these areas, you should be able to resolve most issues with activating Conda environments in VS Code’s PowerShell terminal.
open the current directory: start .
use the help
command followed by the name of the command: help dir
Windows command line search for exact extension with dir 1: dir /s /b *.txt | findstr /v .txt.
Commands(windows) | Short description | Equivalent PowerShell |
macOS |
---|---|---|---|
START | Start a program, command or batch file • | Invoke-Item Start-Process |
open |
DEL | Delete one or more files • | rm | |
DIR | Display a list of files and folders • | ls | |
HELP | Online Help | Get-Help | man |
Set the Environment Variable:
Open Command Prompt as Administrator: Press Windows
+ X
and select “Command Prompt (Admin)” or “Windows PowerShell (Admin)” to open a terminal with administrator privileges.
$Env:PATH
nicely printed
$Env:PATH -split ';' | ForEach-Object { $_ }
for %G in ("%PATH:;=" "%") do @echo %G
with filter
for %G in ("%PATH:;=" "%") do @echo %G | find "conda"
Set the Environment Variable: You can use the setx
command to add the directory containing conda.bat
to your system's Path
environment variable. The command format is as follows:
setx PATH "%PATH%;C:\ProgramData\anaconda3\condabin"
Remove a PATH
You can do this through the System Properties dialog (search for "Edit the system environment variables")
Windows Key + R
to open the Run dialog.
CMD
windownsysdm.cpl
and press Enter
or click OK
.Advanced
tabEnvironment Variables
to edit, add, or delete system and user environment variables.Another method to directly reach the Environment Variables window is:
Windows Key + R
to open the Run dialog.rundll32 sysdm.cpl,EditEnvironmentVariables
and press Enter
or click OK
.FAQ:
cpu-benchmark>python cpu-benchmark.py
git clone https://github.com/alexdedyura/cpu-benchmark
cd cpu-benchmark
Brand | CPU | Arch | OS | Benchmarking |
---|---|---|---|---|
TC17 | Intel(R) Core(TM) i9-14900KF | AMD64 | Windows | 15.654 |
Dell Precision 3561 | 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz | AMD64 | Windows | 23.852 |
WUYING: 8 vCPU / 16 GiB Linux | Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz | x86_64 | Linux | 33.572 |
Intel(R) Xeon(R) Gold 6126 CPU @ 2.60GHz | x86_64 | Linux | 38.685 | |
Intel(R) Xeon(R) CPU E5-2643 v4 @ 3.40GHz | AMD64 | Windows | 39.258 | |
google colab free tier | Intel(R) Xeon(R) CPU @ 2.20GHz | x86_64 | Linux | 43.078 |
Intel(R) Xeon(R) Gold 6126 CPU @ 2.60GHz | AMD64 | Windows | 62.969 | |
Oracle 1G-1G-0.5Gbps | AMD EPYC 7551 32-Core Processor | x86_64 | Linux | 98.732 |
Currently, the two dominant architectures are:
The terms AMD64
, x86_64
, and aarch64
refer to different CPU architectures, each with distinct characteristics and intended uses. Here's a breakdown of each:
Origin:
Design:
Compatibility:
Origin:
Design:
Compatibility:
The term arm64e
refers to an enhanced version of the arm64
architecture, specifically implemented by Apple to support new security and performance features on its platforms. Here’s a detailed look at what arm64e
entails:
Origin
Developer: arm64e
was developed by Apple as an evolution of the standard ARM64 (also known as ARMv8-A) architecture.
Purpose: The primary motivation behind arm64e
was to increase the security of software running on Apple devices, especially to protect against exploits that manipulate code execution flow.
Introduction: Apple introduced arm64e
with the release of the A12 Bionic chipset, which first appeared in the iPhone XS, XS Max, and XR in 2018.
Design
Pointer Authentication: The standout feature of arm64e
is Pointer Authentication, which adds a cryptographic signature to pointers, verifying their integrity before use. This mechanism significantly reduces the risk of common security threats such as return-oriented programming (ROP) and jump-oriented programming (JOP) attacks.
Architecture Improvements: While maintaining a strong backward compatibility with ARMv8-A, arm64e
incorporates changes at the instruction set level to support the generation and verification of pointer signatures.
Security Focus: The enhancements in arm64e
are geared towards hardening Apple devices against exploits by making unauthorized code execution more challenging and thereby bolstering overall system security.
Compatibility
Backward Compatibility: arm64e
is designed to be backward compatible with the arm64
architecture. Applications compiled for arm64
can run on systems supporting arm64e
without modifications, although they won't benefit from the new security features unless recompiled with arm64e
support.
Development Environment: Developers aiming to utilize arm64e
features need to use Apple's Xcode and compile their applications specifically for arm64e
. This ensures that the new security enhancements are properly implemented in their applications.
Device Support: arm64e
is supported on Apple devices with the A12 chipset and later. This includes not only iPhones but also iPads and potentially other future Apple devices as the company continues to deploy this architecture in its new hardware.
SWOT (Strengths, Weaknesses, Opportunities, Threats) analysis for the top four job scheduler1 packages on PyPI—Apache Airflow, APScheduler, Prefect, and Schedule—I'll highlight their main features and use them to assess each tool across these categories.
Strengths:
Weaknesses:
Opportunities:
Threats:
Strengths:
Weaknesses:
Opportunities:
Threats:
Strengths:
Weaknesses:
Opportunities:
Threats:
Strengths:
Weaknesses:
Opportunities:
Threats:
This SWOT analysis provides an overview of where each scheduler stands in terms of its strengths and weaknesses and how it can navigate its opportunities and threats in the competitive landscape of job scheduling tools.
Q:
To search for all Markdown files (typically having the .md extension) recursively in a directory using "Everything," a desktop search utility for Windows that can instantly locate files and folders by name,
A:
Specify the Directory: To search within a specific directory, you'll need to use the path of the directory as part of your search query. For your example directory (J:\My Drive
), you would start your query with the path, ensuring to use double quotes if your path contains spaces.
Use Wildcards for Recursive Search: To find all Markdown files recursively, use a wildcard pattern that matches .md
files.
Combine Path and Pattern: Your search query in Everything should look like this:
"J:\My Drive" *.md
Q:
search for a path that contains a specific keyword, such as "github"
A:
Modifiers: Functions and regular search terms can be prefixed with a modifier.
count:5 path: github\tdm23
Q:
To search for all markdown files under a partial path (e.g., "oracle", "docs\productivity" )
A:
path:*orac* *.md
or
path: *docs\prod* .md
This query does the following:
path:orac: Searches for paths that contain the string "orac" anywhere in the path. The asterisks (*) are wildcards that match any sequence of characters, allowing "orac" to appear anywhere within the directory name. *.md: Filters the results to only show files with the .md extension, which are Markdown files.
Q:
A:
J:\My Drive
), you would start your query with the path, ensuring to use double quotes if your path contains spaces..md
files."J:\My Drive" *.md
Q:
A:
Modifiers: Functions and regular search terms can be prefixed with a modifier.
childcount:<count> |
Search for folders that contain the specified number of subfolders and files. |
---|---|
folder:folders:nofolderonly: |
Match folders only. |
count:5 path: github\tdm23
Q:
A:
path:*orac* *.md
or
path: *docs\prod* .md
This query does the following:
path:orac: Searches for paths that contain the string "orac" anywhere in the path. The asterisks (*) are wildcards that match any sequence of characters, allowing "orac" to appear anywhere within the directory name.
*.md: Filters the results to only show files with the .md extension, which are Markdown files.
WSGI (Web Server Gateway Interface) and ASGI (Asynchronous Server Gateway Interface) are both specifications in Python for connecting web servers with web applications. WSGI has been the standard for Python web application development for many years, while ASGI is relatively newer and designed to extend WSGI to support asynchronous applications.
The choice between WSGI and ASGI depends on the specific needs of your application:
It's also worth noting that some frameworks, such as Django (since version 3.0), have started to offer support for both WSGI and ASGI, allowing developers to choose the most appropriate option based on their application's requirements.
is FASTapi / Django / Flask ASGI or WSGI
FastAPI, Django, and Flask are popular web frameworks in the Python ecosystem, each with its design philosophies, use cases, and support for WSGI or ASGI.
In summary:
how about the Tornado Web Server that Jupyter Notebook uses as backend, what is its relation to WSGI/ASGI
Tornado is a Python web framework and asynchronous networking library that differs significantly from traditional WSGI/ASGI frameworks. It was designed to handle asynchronous I/O, which makes it well-suited for long-lived network connections and high-concurrency applications, such as long polling, WebSockets, and other applications where a lot of connections need to be open simultaneously. Tornado is particularly known for its high performance and scalability.
WSGIAdapter
. However, when run in this mode, Tornado operates synchronously, which means it loses the benefits of its asynchronous capabilities. It's not the most common use case for Tornado but provides a way to integrate or migrate existing WSGI applications.asyncio
library where appropriate. For projects that are specifically designed around ASGI's interface, frameworks like Starlette, FastAPI, or channels (for Django) are more directly compatible.Jupyter Notebook uses Tornado as its web server primarily because of its ability to handle multiple simultaneous connections efficiently, which is crucial for a web application like Jupyter that maintains long-lived connections to support interactive computing sessions. Tornado's support for WebSockets is also beneficial for the real-time, bidirectional communication between the client (browser) and the server that Jupyter requires.
Tornado stands somewhat apart from the WSGI/ASGI dichotomy, offering its own approach to asynchronous web serving and application development. It's especially suitable for applications requiring a lot of open connections and real-time data exchange, making it an excellent choice for Jupyter Notebook's backend. While it can work with WSGI applications, doing so is generally not leveraging Tornado's strengths in asynchronous operation.
what kind of backend does gradio/streamlit use
Gradio and Streamlit are both Python libraries designed to make it easier for data scientists and developers to create interactive web applications for machine learning models, data visualization, and analysis with minimal web development experience required. Each takes a different approach to how they serve content and manage the backend.
Gradio typically uses Flask as its web server backend. Flask is a lightweight WSGI web application framework that provides the necessary tools to build web applications quickly and with minimal boilerplate code. Gradio leverages Flask to create a simple web server that can host the interfaces for machine learning models or any Python function. Gradio's use of Flask makes it easy to integrate with existing Python data science and machine learning ecosystems.
Streamlit, on the other hand, has its own custom server mechanism built on top of Tornado, which is an asynchronous networking library and web server framework. Tornado allows Streamlit to handle web sockets and manage real-time updates to the user interface, which is essential for creating interactive applications that respond to user input without requiring a page reload. Streamlit's server architecture is designed to streamline the process of deploying data applications by abstracting away much of the complexity involved in web app development.
Both Gradio and Streamlit abstract much of the web development process, allowing developers and data scientists to focus on Python code rather than the intricacies of web frameworks, HTTP, or frontend technologies. Their different backend choices reflect their distinct approaches to simplifying web application development for data-driven projects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.