You are not logged in.

#1 2020-11-07 18:59:42

JeanEdouardKevin
Member
Registered: 2020-11-07
Posts: 5

Bad python env version.

Hi, recently installed anaconda for coding but idk why, it got set as my default python env and it messes things up.
I added anaconda to my path in the `/etc/profile` with `export PATH="/opt/anaconda/bin:$PATH"`.
`which python` outputs /opt/anaconda/bin/python i would like to set it to /usr/bin/pyhton but i don't know how to do it, i searched on internet and read the python manual but i didn't fount how to do it. It is a problem because some python programs needs modules and packages that anaconda does not have. I know i can set an alias python='/usr/bin/python' but i assume that it wont change the python env.

Thanks in advance for your help.

Offline

#2 2020-11-07 20:00:38

teckk
Member
Registered: 2013-02-21
Posts: 518

Re: Bad python env version.

Hi, recently installed anaconda

How? Was it this?
https://aur.archlinux.org/packages/anaconda

Or with pip? Or did you put a binary there?

Offline

#3 2020-11-07 21:10:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Bad python env version.

JeanEdouardKevin wrote:

Hi, recently installed anaconda for coding but idk why

We don't know why either.  Really, no one should do that.

JeanEdouardKevin wrote:

export PATH="/opt/anaconda/bin:$PATH" ... `which python` outputs /opt/anaconda/bin/python i would like to set it to /usr/bin/pyhton but i don't know how to do it

Setting PATH to prioritize anaconda is the cause of the problem, if you want to undo it, remove that export line from your profile.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2020-11-07 22:33:22

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Bad python env version.

Trilby wrote:
JeanEdouardKevin wrote:

Hi, recently installed anaconda for coding but idk why

We don't know why either.  Really, no one should do that.

Disagree. I'm not giving root access to my university's HPC users, and I'm sure as hell not going to build, install and maintain every scientific application under the sun for them, ensuring old versions remain accessible for reproducibility. They can use conda for that. If you want to give up your time to reproduce what the bioconda repositories provide outside of conda, feel free.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2020-11-07 23:06:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Bad python env version.

WorMzy wrote:

I'm not giving root access to my university's HPC users

What on earth does this have to do with this thread?  We are not talking about your university's HPC users, we talking about JeanEdouardKevin's arch linux system ... on which he clearly has root access as he installed anaconda systemwide ... which - by the way - is discouraged by this community's wiki.

Also ... By you!:

WorMzy wrote:

Installing anaconda as a system package seems like bad idea to me. My recommendation is avoid anaconda if at all possible ...

Because to me, anaconda is just a way of giving users the ability to install the software they need on systems that they otherwise wouldn't be able to install software on

Last edited by Trilby (2020-11-07 23:11:09)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2020-11-07 23:51:47

JeanEdouardKevin
Member
Registered: 2020-11-07
Posts: 5

Re: Bad python env version.

teckk wrote:

Hi, recently installed anaconda

How? Was it this?
https://aur.archlinux.org/packages/anaconda

Or with pip? Or did you put a binary there?

It was the AUR package, but my question is pretty basic, it's about how to set the default python, does my anaconda version matters for that?

Offline

#7 2020-11-07 23:56:47

JeanEdouardKevin
Member
Registered: 2020-11-07
Posts: 5

Re: Bad python env version.

Trilby wrote:
JeanEdouardKevin wrote:

export PATH="/opt/anaconda/bin:$PATH" ... `which python` outputs /opt/anaconda/bin/python i would like to set it to /usr/bin/pyhton but i don't know how to do it

Setting PATH to prioritize anaconda is the cause of the problem, if you want to undo it, remove that export line from your profile.

Thank you for your help, but I still need to keep anaconda in my path to use it, do you know how I could keep it while not prioritizing it?

Last edited by JeanEdouardKevin (2020-11-07 23:57:37)

Offline

#8 2020-11-08 00:00:50

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Bad python env version.

Hmm, maybe I misconstued what you meant by 'no one should do that', I felt that expanded the scope of discussion away from just JeanEdouardKevin's Arch Linux system, but perhaps I was mistaken? Please feel free to clarify if I've misinterpreted your reply.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2020-11-08 00:27:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Bad python env version.

JeanEdouardKevin wrote:

Thank you for your help, but I still need to keep anaconda in my path to use it, do you know how I could keep it while not prioritizing it?

You do not need it in your (default / global) path to use it.  You could put it last (instead of first) but I doubt that would meet your goals.  I believe anaconda would need `which python` to resolve to the one in /opt - this goal is mutually exclusive to your goal of having `which python` resolve to the one in /usr/bin.  You simply can't have it both ways - at least not in a default / global context.  This is - as I understand - precisely what venvs are for, though.

@WorMzy, yes, sorry, my statement was somewhat vague.  I could have said "no one one these forums" or "no one who would be posting here" or "no one who's system would be supported by this community" - but those are all kind of a given in discussions here.  Personally I DO think no one at all should use it.  Debating that point as it applies to arch users may have a place on these forums - but from your own posts, you would apparently concede this point.  Debating that point as it applies to Windows users or users of other distros does not have any place on these forums.  In any case, please offer something to actually help the OP, or find a way to conduct yourself better as a moderator than to snipe facetiously and irrelevantly on a trivial comment.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2020-11-08 02:43:04

JeanEdouardKevin
Member
Registered: 2020-11-07
Posts: 5

Re: Bad python env version.

Trilby wrote:
JeanEdouardKevin wrote:

Thank you for your help, but I still need to keep anaconda in my path to use it, do you know how I could keep it while not prioritizing it?

You do not need it in your (default / global) path to use it.  You could put it last (instead of first) but I doubt that would meet your goals.  I believe anaconda would need `which python` to resolve to the one in /opt - this goal is mutually exclusive to your goal of having `which python` resolve to the one in /usr/bin.  You simply can't have it both ways - at least not in a default / global context.  This is - as I understand - precisely what venvs are for, though.

Yeah you're right... But to precise my goal, i want anaconda's commands like anaconda-navigator or jupyter to be in my PATH so i can use anaconda's env when i need it but i do not want anaconda to be my default, global python env. Do you know a way to define your default python interpreter? Maybe in some config file or with a shell command...

Offline

#11 2020-11-08 03:03:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Bad python env version.

I have no (good) experience with anaconda, but if you put the opt path *last* in your PATH, you would be able to use the system python (in /usr/bin/) and all the anaconda-navigator and other tools would also be available to you.  My only concern with this is that those tools might run into trouble if they need to be able to call just "python" and get /opt/anaconda/bin/python instead of /usr/bin/python.  So you could try this:

export PATH="$PATH:/opt/anaconda/bin"

A much better approch, though, would be simply to not use anaconda: either use venv(s) or properly packaged system tools (there are packages for jupyter).

Of course if you just want to be able to change on demand, just don't mess with your PATH variable at all in your profile, and just set it when needed.  In other words, use the same PATH export as in your first post, but use that command in the interactive session when you plan to use your anaconda stuff, but not otherwise.

Last edited by Trilby (2020-11-08 03:39:40)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2020-11-08 03:27:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Bad python env version.

JeanEdouardKevin wrote:

Yeah you're right... But to precise my goal, i want anaconda's commands like anaconda-navigator or jupyter to be in my PATH so i can use anaconda's env when i need it but i do not want anaconda to be my default, global python env. Do you know a way to define your default python interpreter? Maybe in some config file or with a shell command...

But /usr/bin/jupyter is provided by community/python-jupyter_core and uses /usr/bin/python.

Actually why don't you just use that?

Also, again, WHY do you think you need anaconda? Absolutely no human being on planet earth should ever user anaconda... unless they at least know why they should prefer it instead of the system python.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#13 2020-11-08 10:23:22

JeanEdouardKevin
Member
Registered: 2020-11-07
Posts: 5

Re: Bad python env version.

Trilby wrote:

I have no (good) experience with anaconda, but if you put the opt path *last* in your PATH, you would be able to use the system python (in /usr/bin/) and all the anaconda-navigator and other tools would also be available to you.  My only concern with this is that those tools might run into trouble if they need to be able to call just "python" and get /opt/anaconda/bin/python instead of /usr/bin/python.  So you could try this:

export PATH="$PATH:/opt/anaconda/bin"

A much better approch, though, would be simply to not use anaconda: either use venv(s) or properly packaged system tools (there are packages for jupyter).

Of course if you just want to be able to change on demand, just don't mess with your PATH variable at all in your profile, and just set it when needed.  In other words, use the same PATH export as in your first post, but use that command in the interactive session when you plan to use your anaconda stuff, but not otherwise.

Thank you! I'll try that

Offline

Board footer

Powered by FluxBB