or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Introduction to conda for (data) Scientists
tags:
workshop
Links
Please rename yourself to "(n) Name" in Zoom (Participant list→hover over your name)
If you're not editing this hackmd document, please go to view mode by clicking the eye button
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Icebreaker
Tell us from where you are following the course and what the weather is like this morning :)
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Getting Started with Conda
What are some of the potential benefits from installing software separately for each project? What are some of the potential costs?
Benefits:
Costs:
Questions
Don't hesitate to ask questions here! We can answer/comment asynchronously.
Does the speed of working in conda the same as that without conda?
Will you later show maybe how I can install in a conda environment with pip a programm? This programm was not available on conda or just in a old version. I don't understand how this works.
Is the appearance of "(base)" after each command the result of having run conda init bash? This means my bash is now permanently linked to the conda base environment? What if I don't want this any more?
conda deactivate
Why does Anne put python pip at the end? She is already choosing packages to install in the enviroment?
Why do I need pip as an extra package in the enviroment? Will this help me later to install packages that are not available on Anaconda, please?
Short answer is yes.
this way we can get a well-defined pip instead of relying on pip from "outside" conda which may or may not be there.
pip is usually installed with together with python
For most cases, you should be able to install packages using conda. Using pip to install a package inside a conda environment should be your last resort as conda and pip do not seem to behave well when used together, and is not recommended. Source: https://www.anaconda.com/blog/using-pip-in-a-conda-environment
- Thank you, I had no clue about this!
Is it normal that autocompletion does not suggets "activate" once I type "conda a" and press TAB?
Where is the env installation located? My folder is still empty
--prefix
, then you decide where the environment installation will be.Is there anything special about conda packages? Do libraries need to be made conda-aware in any way before they can be used within conda or can anything go in an environment?
Is there a more general way to find $PACKAGE_NAME then googling? For instance, is there any keyword-based search? Maybe a search where I can specify compatibility requirements…
conda search
you can check if the package exists, and which versions are availableso basically we create our own anaconda just with limited no of packages
I understood if I don't request the version, the latest one is automatically installed? Do I need to bother with the searching, please?
I was just asking because Anne went to the package websites to check for the latest version. That irritated me.
(from chat) Is the existence of posible conflicts between packages verified upon creation of an environment (e.g. if one old package version is specified)
Anne looked up ipython and came up with 7.12 as latest but if we run conda search ipython it shows 7.19 as latest, not 7.12
Is there a way to list all activated environments?
(machine-learning-env)computername@something:$
conda env list
Why does the last digit does not have to be mentioned when specifying the version of a package?
Is it possible to rename an environment after creation?
-
conda create --name new_name --clone old_name
How to list all packages that are inside an environment
conda list
within the activated environmentDo we always need to install pip? (a question that came up in breakout room)
Is there a way to find out which packages and versions were specified when creating an environment?
conda list
lists all packages, including dependencies.--from-history
which makes this more convenient. another thing I do to answer this question to myself few months later is to install fromenvironment.yml
(which we will see in a moment)It seems to me that conda installs everything under ~anaconda/envs so I end up with multiple full installations of packages (python and everything else) taking up increasingly large space. Anyway is it correct to say that conda basically consists of (a) installing stuff under envs and (b) modifying the shell path ?
What is the reason behind the best practice of explicitly adding version number? I mean, can't I share an environment by sending the print out of 'conda list', or something similar, rather than saying 'conda create my-env blabla=X.Y'? Creating the env with the explicit version numbers equal to the latest one from 'conda search' did exactly the same as not specifying any version number.
trick for finding latest version: do a
conda create —name X numba,
wait for the prompt, look up the version of numba that would be installed, and select ’n’ so no environment is createdfrom our breakout room: running
conda search pandas
resulted in mutliple lines for the latest version (1.20). What are the differences, do we need to choose one explicitely (and how) and what happens if we don't?Exercises
https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/02-working-with-environments/index.html
Look for the exercises starting with 'Create a new environment called “machine-learning-env”'
Time: until XX:23
I cannot find the text describing the exercise?
Typing the latest available major versions (based on conda search) and then the create command leads to conflicts – is this part of the exercise or have I screwed something up?
Progress
Room 1: finished
Room 2 : finished
Room 3: had good discussion on incompatible packages, covered most of the exercise except discussing conda deactivate in more detail at the end
Room 4
Room 5: almost done not everyone succeed to run deactivate
Room 6: finishing exercises and discussing questions
Room 7: finished exercises
Being lazy and forget about the versions, seems to be an advantage here at least. Ah, I see now what Anne means.
Break until XX:43
We are here: "Installing a package into an existing environment"
https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/02-working-with-environments/index.html
Questions below here
Why did you install pip if you are going to be using conda install instead?
can I remove/uninstall a package from the environment?
conda remove package
from within activated environment orconda remove --name yourenvname package
from outsidewhat is the cmd to list all installed packages in an env?
conda list
from within the activated environmentmachine-learning-env folder is is 1Gb+!!!
does it make sense to put a conda env inside the git repo of a project that uses that env?
environment.yml
to the Git repository (so that others can recreate it on their side).Who designed this lecture? Somebody wrote higher up "- This is to be answered in later episode. I understand the confusion, and this is where we discussed a lot with the lesson developer as well about where to introduce pip."
So David Pugh is the lesson developer referred to?
with
conda create --prefix ./env
you don't use thename
argument?Cool, 'conda env list' list also the environments created locally with the –prefix!
Exercise
until xx:08
Still on this page: https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/02-working-with-environments/index.html
(sorry, still no anchor links)
More questions (also questions that came up in group work)
--name
creates an environment with a specific name in the default location--prefix
: specifies the location and now the location is the name.--name
creates a subfolder in default location, but--prefix
: you decide where it is.conda search
I get results from pkg/main and conda-forge. conda-forge seems to be added as a channel to search for packages even if it is not specified. How can I undo that?conda config --get channels
and remove withconda config --remove channels
, this will adjust your .condarc file where your configurations are storedIs consistency between packages coming from different channels guaranteed somehow?
I used mostly "conda install package_name". I understand it comes from the main channel then. Was this bad?
conda config --show channels
How to find available channels? (orally asked question)
Can I mix packages from different channels? Looks like I have to do this with pytorch when I want to use it, but have previously installed python from the main-package?
I don't understand who this would work then together. Use two different environments for one project? Or I have to specify the path to the library when I am importing it?
environment.yml
(we will learn about that file in a moment)Is your recommendation to switch to conda-forge?
does every channel name require the keyword –channel?
environment.yml
The issues with finding the right channels sound very much like the original problem of finding the right package to install, which was the original problem that the package manager was asked to solve… are we running in circles?
environment.yml
(next lesson episode?)environment.yml
is mentioned repeatedly… will wwe look into where it is, what it is and so?-yes in about 20 min :)
excellent, thanks!
If I have added conda-forge to my channel list. What is the best way to remove it?
conda config --remove channels CHANEL_NAME
conda config --show channels
conda config --remove channels conda-forge
Anne's example shows mixing packages from differnt channels. Does it seem that conda takes care a bit of that?
Can you install inside the environment even if the environment isn’t activated?
Break until XX:43
Working with environment files
https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/04-sharing-environments/index.html
Will you discuss how to include my own code, still under development, in a conda environment? In case I don't want to be in the same directory as my .py files all the time? I.e., something like
pip install -e
pip install -e .
is good if you plan to distribute your code via PyPI but you want to test it locally in place.import
)So when exporting to a .yml, using –file is the same of redirecting to file with '>', right?
funny thing… in Samantha's terminal there were duplicates in the list of dependencies… and I can reproduce it on my system. 'prompt_toolkit=3.0.8' is listed twice
--from-history
I assume you won't cover this here, but are you considering making a lesson on how to make your own conda packages (or Python packaging in general for that matter)? And how to set up your own channels (in the cloud or locally)? Or are there some good materials you can recommend?
does the order of arguments matter? –name, –file –from-history?
about the –from-history. It looks like making a .yml using –from-history puts some trust on the channels w.r.t rebuilding all the rest of the packages. Any comment on this? Is it best to just make sure we have all packages in the .yml?
--prefix
environment.yml
and then I know it works. So whenever I need something, I first add it to the file, then install from it.environment.yml
. channels you used for installation will be added too.Can colleagues at the same institution using the same server or cluster use the same environment if it is installed in a location they can all read (e.g., if one person sets it up, and everybody else who isn't proficient in conda just uses
conda activate
)source PATH/setup.source
and everything good to go (also a unset.source to deactivate)Does the differences in channel affect the reproducibility?
how to recreate a specific environment on supercomputer such as CSC? will it be possible?
what is first - environment file and then using it updating packages or
first updating paackages and then creating an environment file?
Would 'conda env create –file environment.yml –force' be the same as 'conda env create –name NAME –force'?
--file environment.yml
it would actually work if you have an environment.yml file in the same location where you call the conda env create, but it is not recommended, better be as specific as possible so that you know exactly what you are doingI don't have nano editor as I use Windows OS. So how do I create YML file?. Should I use notepad?. Thanks
you can install nano with conda, but one of the best (and at the same time accessible and easy to learn) editors these days is Visual Studio Code (open source) which I can warmly recommend for creating/editing such files.
notepad also works
There is a difference between 'conda list env' and 'conda env list.'
The first command seems to give me only my created env with the prefix, the other command lists all my env.
I am a bit confused.
Exercises
Until xx:30
https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/04-sharing-environments/index.html
After that: wrap-up
Concluding remarks
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Feedback
One thing that was particularly good
One thing to improve
Suggestions for material
conda env list
whether it has been installed correctly.future training on containers
Below some links:
Always ask questions at the very bottom of this document, right above this. Switch to view mode if you are only watching.
We are monitoring this hackMD, but we will reply every now and then so that you can focus on the speaker.