mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 11:13:04 +03:00
feat(*): remove references to conda
This commit is contained in:
parent
609fc84e43
commit
298d5ef149
5 changed files with 17 additions and 55 deletions
|
|
@ -83,7 +83,7 @@
|
|||
(message "%f Gb" (/ (float data) 1024 1024)))))
|
||||
|
||||
(use-package micromamba
|
||||
:straight (:local-repo "~/10-19 Code/12 My Emacs Packages/12.12 micromamba.el")
|
||||
:straight (:host github :repo "SqrtMinusOne/micromamba.el")
|
||||
:if (executable-find "micromamba")
|
||||
:config
|
||||
(micromamba-activate "general"))
|
||||
|
|
@ -726,7 +726,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
"" '(:which-key "various completions")'
|
||||
;; "b" 'counsel-switch-buffer
|
||||
"b" 'persp-ivy-switch-buffer
|
||||
"e" 'conda-env-activate
|
||||
"e" 'micromamba-activate
|
||||
"f" 'project-find-file
|
||||
"c" 'counsel-yank-pop
|
||||
"a" 'counsel-rg
|
||||
|
|
|
|||
38
Emacs.org
38
Emacs.org
|
|
@ -57,6 +57,8 @@ I decided not to keep configs for features that I do not use anymore because thi
|
|||
| org-trello | 3f5967a5f63928ea9c8567d8d9f31e84cdbbc21f |
|
||||
| jabber | 9b0e73a4703ff35a2d30fd704200052888191217 |
|
||||
| wallabag | 9b0e73a4703ff35a2d30fd704200052888191217 |
|
||||
| conda | 609fc84e439b11ea5064f3a948079daebb654aca |
|
||||
|
||||
* Initial setup
|
||||
Setting up the environment, performance tuning and a few basic settings.
|
||||
|
||||
|
|
@ -217,46 +219,14 @@ I have some concerns that =ps -o rss= may be unrepresentative because of [[https
|
|||
(lambda (data)
|
||||
(message "%f Gb" (/ (float data) 1024 1024)))))
|
||||
#+end_src
|
||||
** OFF Anaconda
|
||||
[[https://www.anaconda.com/][Anaconda]] is a free package and environment manager. I currently use it to manage multiple versions of Python and Node.js. Take a look at [[file:Guix.org::*conda][the corresponding entry]] in the Guix config for details about using it on Guix.
|
||||
|
||||
The following code uses the =conda= package to activate the base environment on startup if Emacs is launched outside the environment.
|
||||
|
||||
Also, some strange things are happening if vterm is launched with conda activated from Emacs, so I advise =conda-env-activate= to set an auxiliary environment variable. This variable is used in the [[file:Console.org::*Anaconda][shell config]].
|
||||
|
||||
References:
|
||||
- [[https://docs.anaconda.com/][Anaconda docs]]
|
||||
- [[https://github.com/necaris/conda.el][conda.el repo]]
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(use-package conda
|
||||
:straight t
|
||||
:if (executable-find "conda")
|
||||
:config
|
||||
(setq conda-anaconda-home (string-replace "/bin/conda" "" (executable-find "conda")))
|
||||
(setq conda--executable-path (executable-find "micromamba"))
|
||||
(setq conda-env-home-directory (expand-file-name "~/.conda/"))
|
||||
(setq conda-env-subdirectory "envs")
|
||||
|
||||
(advice-add 'conda-env-activate :after
|
||||
(lambda (&rest _)
|
||||
(setenv "EMACS_CONDA_ENV" conda-env-current-name)
|
||||
(setenv "INIT_CONDA" "true")))
|
||||
(advice-add 'conda-env-deactivate :after
|
||||
(lambda (&rest _)
|
||||
(setenv "EMACS_CONDA_ENV" nil)
|
||||
(setenv "INIT_CONDA" nil)))
|
||||
(unless (getenv "CONDA_DEFAULT_ENV")
|
||||
(conda-env-activate "general")))
|
||||
#+end_src
|
||||
** Micromamba
|
||||
[[https://github.com/mamba-org/mamba][mamba]] is a faster alternative to [[https://www.anaconda.com/][Anaconda]], a package and environment manager. =micromamba= is a tiny version that provides a subset of mamba commands.
|
||||
|
||||
=micromamba.el= is my package to interact with the latter.
|
||||
[[https://github.com/SqrtMinusOne/micromamba.el][micromamba.el]] is my package to interact with the latter.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package micromamba
|
||||
:straight (:local-repo "~/10-19 Code/12 My Emacs Packages/12.12 micromamba.el")
|
||||
:straight (:host github :repo "SqrtMinusOne/micromamba.el")
|
||||
:if (executable-find "micromamba")
|
||||
:config
|
||||
(micromamba-activate "general"))
|
||||
|
|
|
|||
22
Guix.org
22
Guix.org
|
|
@ -676,29 +676,21 @@ nmcli connection up "$CONN"
|
|||
** flatpak
|
||||
As for now, the easiest way to install most of proprietary software is via flatpak. See the relevant section in [[file:Desktop.org][Desktop.org]].
|
||||
|
||||
** conda
|
||||
[[https://docs.conda.io/en/latest/][conda]] is a package manager, which I use for managing various versions of Python & Node.js.
|
||||
** micromamba
|
||||
+[[https://docs.conda.io/en/latest/][conda]]+ [[https://github.com/mamba-org/mamba][mamba]] is a package manager that I use for managing various versions of Python & Node.js.
|
||||
|
||||
It is packaged for GNU Guix, although the definition has its fair share of workarounds. It is almost surprising to see it work with all the C libraries and stuff. But there are still some problems.
|
||||
=mamba= is a reimplementation of =conda= in C++. =mamba= is notably much faster and mostly compatible with =conda=, and =micromamba= is a tiny version of =mamba= that is contained in one statically linked exectuable. I've migrated to =micromamba= mostly because of speed.
|
||||
|
||||
First, it's impossible to perform =conda init= to patch files like =.bashrc=, because the command is hell-bent on modifying =/gnu/store/=. So I do this manually, look for the =init_conda= procedures in [[file:Console.org][Console.org]].
|
||||
=conda= is packaged for Guix with its fair share of quirks, mostly concerning the impossibility of changing the base environment in =/gnu/store/=. =micromamba= has none of that because it doesn't ship with a base environment. It's not packaged for Guix yet, so I've made a definition with =binary-build-system= in my channel.
|
||||
|
||||
Second, the base environment has =/gnu/store/...= as a root, so don't install anything there (and don't run =conda= with superuser rights!).
|
||||
You may need to unset =$PYTHONPATH= if you have any global packages installed, otherwise Python from the environemnt will try to import them instead of the conda versions.
|
||||
|
||||
Third, by default it tries to create envronments in =/gnu/store=. It's enough to create one environment like this to fix it:
|
||||
#+begin_src sh
|
||||
mkdir -p ~/.conda/envs
|
||||
conda create -p ~/.conda/envs/test
|
||||
#+end_src
|
||||
|
||||
Fourth, you may need to unset =$PYTHONPATH= if you have any global packages installed, otherwise Python from anaconda will try to import them instead of the conda versions.
|
||||
|
||||
Finally, I also want to have an ability to use global npm. Some settings for that are located in [[file:Console::*npm][Console.org]]. Here we want to unset =NPM_CONFIG_USERCONFIG= if there is npm available in the environment.
|
||||
I also want to have an ability to use global npm. Some settings for that are located in [[file:Console::*npm][Console.org]]. Here we want to unset =NPM_CONFIG_USERCONFIG= if there is npm available in the environment.
|
||||
|
||||
So here is a script to set up conda hooks:
|
||||
#+begin_src bash :tangle ~/bin/scripts/setup-conda-npm
|
||||
# Get writable conda envs with npm & without it
|
||||
readarray -t CONDA_ENVS_ALL <<< $(conda env list --json | jq '.envs[]')
|
||||
readarray -t CONDA_ENVS_ALL <<< $(micromamba env list --json | jq '.envs[]')
|
||||
CONDA_ENVS_NPM=()
|
||||
CONDA_ENVS_NO_NPM=()
|
||||
for env in "${CONDA_ENVS_ALL[@]}"; do
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# [[file:../../Guix.org::*conda][conda:2]]
|
||||
# [[file:../../Guix.org::*micromamba][micromamba:1]]
|
||||
# Get writable conda envs with npm & without it
|
||||
readarray -t CONDA_ENVS_ALL <<< $(conda env list --json | jq '.envs[]')
|
||||
readarray -t CONDA_ENVS_ALL <<< $(micromamba env list --json | jq '.envs[]')
|
||||
CONDA_ENVS_NPM=()
|
||||
CONDA_ENVS_NO_NPM=()
|
||||
for env in "${CONDA_ENVS_ALL[@]}"; do
|
||||
|
|
@ -33,4 +33,4 @@ for env in "${CONDA_ENVS_NO_NPM}"; do
|
|||
rm -rf "$env/etc/conda/deactivate.d/conda.sh" || true
|
||||
rm -rf "$env/etc/conda/deactivate.d/conda.fish" || true
|
||||
done
|
||||
# conda:2 ends here
|
||||
# micromamba:1 ends here
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# [[file:/yadm:iris:/home/pavel/Guix.org::*vpn-start][vpn-start:1]]
|
||||
# [[file:../../Guix.org::*vpn-start][vpn-start:1]]
|
||||
export DISPLAY=:0
|
||||
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*|vnet.*|virbr.*)" | sed 's/ *$//g')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue