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

Anaconda interferes with clear command in Terminal #331

Open
blink1073 opened this issue May 9, 2015 · 26 comments
Open

Anaconda interferes with clear command in Terminal #331

blink1073 opened this issue May 9, 2015 · 26 comments

Comments

@blink1073
Copy link

When I add the anaconda/bin folder to my path:

silvester: ~
$ clear
'xterm-256color': unknown terminal type.
silvester: ~
$ infocmp
infocmp: couldn't open terminfo file /Users/aaronmeurer/anaconda/envs/_build_placehold_placehold_placehold_placehold_/share/terminfo/78/xterm-256color.

Otherwise the clear command works just fine.

cc @asmeurer, since your name is in the path. 😄

$ conda info
Current conda install:

             platform : osx-64
        conda version : 3.12.0
  conda-build version : 1.8.2
       python version : 3.4.3.final.0
     requests version : 2.7.0
     root environment : /Users/silvester/anaconda  (writable)
  default environment : /Users/silvester/anaconda
     envs directories : /Users/silvester/anaconda/envs
        package cache : /Users/silvester/anaconda/pkgs
         channel URLs : https://conda.binstar.org/asmeurer/osx-64/
                        https://conda.binstar.org/asmeurer/noarch/
                        https://repo.continuum.io/pkgs/free/osx-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/osx-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : /Users/silvester/.condarc
    is foreign system : False
@blink1073
Copy link
Author

Note @asmeurer, I added your binstar channel to install PyQt5.

@blink1073
Copy link
Author

That actually may be the problem, because if I activate another conda environment, the problem goes away.

@blink1073
Copy link
Author

Actually, there is an infocmp in the main bin, but not in the environment bin directory.

@blink1073
Copy link
Author

If I just remove that one file, I get a garbage printout from infocmp, so there is at least one other file in there interfering.

@gawbul
Copy link

gawbul commented Dec 8, 2016

I'm getting the same issue, @blink1073 - if append to path (as opposed to prepend) it works fine, but that gives system python etc. higher precedence. Any further with this at all?

@NiziL
Copy link

NiziL commented Oct 31, 2017

Got the same issue with termite and unicode-rxvt on Archlinux and found a simple (but ugly) workaround: ln -s /usr/share/terminfo/x/xterm-termite path_to_conda_env/env/share/terminfo/x/.

Unfortunately, this should be done for each env (including root env).
At least I can clear my console again ^^

@dantp-ai
Copy link

You might have moved the anaconda directory after installation and some bash script links are still pointing to the previous location. Simplest solution is to delete your current anaconda installation directory, remove any paths in .bashrc pointing to it and reinstall it in the desired location.

@alexacallmebaka
Copy link

alexacallmebaka commented Oct 31, 2020

The "clear" command only works when I am outside of a conda environment or if I am root. @plopd fix did not work.

@1971hemicuda
Copy link

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

@BUCKFAE
Copy link

BUCKFAE commented Mar 17, 2021

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

Did the trick for me! (Manjaro)

@pocco81
Copy link

pocco81 commented Mar 28, 2021

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

Did the trick for me! (Manjaro)

Did the trick for as well on both Ubuntu and Debian! btw, I think this should obviously work on any Linux distro, because they all have the same file system, at least that's what I know.

@aimuhire
Copy link

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

Did the trick for me! (Manjaro)

For me on Macbook, It worked.

@Maxsash
Copy link

Maxsash commented May 12, 2021

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

Did the trick for me! (Manjaro)

Workes on Garuda Linux (Arch based).

@sagard21
Copy link

sagard21 commented Jun 29, 2021

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old
Worked for me too. Thanks

@Alex-Kopylov
Copy link

I found that renaming the $CONDA_PREFIX/bin/clear has resolved the issue

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

Did the trick for me! (Manjaro)

THX! After restarting terminal it works as intended.

@manojuppala
Copy link

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old
This worked absolutely fine for me (on linux mint). but may i know what this means?

@Hemant-ML
Copy link

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old

also works for my ubuntu 20.04.

@Yaser-wyx
Copy link

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old
it works for me too!
if it does not work for you, maybe can restart your terminal.

@ariveron
Copy link

ariveron commented Aug 24, 2021

sudo mv $CONDA_PREFIX/bin/clear $CONDA_PREFIX/bin/clear_old
This worked absolutely fine for me (on linux mint). but may i know what this means?

This is renaming the anaconda "clear" binary to "clear_old" so that it doesn't interfere with the default "clear" program. This is probably needed because the anaconda binaries folder path is being prepended to PATH, instead of appending.

Instead of renaming the anaconda "clear" binary, I changed this line in my ~/.bashrc file from:

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

to this

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

@Mohamed-Aziz-Ben-Nessir

manually changed it , works on artix

@brainwave
Copy link

brainwave commented Dec 15, 2021

I use kitty and the miniconda clear program refused to clear my terminal's output. Probably because miniconda clear only worked with xterm compliant shells, while Kitty is not? The problem also occurs because miniconda prepends path of newly created environments to the shell PATH, instead of appending to it. So in order of precedence, miniconda clear triggers instead of system clear binary. To solve this, I copied my system clear from /usr/bin/clear to the miniconda3/bin folder and the problem is resolved for now. need to see if the hack sustains through various conda upgrades.

@zhyiyu
Copy link

zhyiyu commented Feb 4, 2022

Wondering if this obvious will be resolved anytime soon...

@iteemhe
Copy link

iteemhe commented Apr 28, 2022

This issue is likely caused by the lack of TERMINFO environment variable. The path to TERMINFO in most Linux system is /usr/share/terminfo. But you need to manually check if the path exists, or it is under another path.

Then, in your .zshrc or .bashrc, include this line.

export TERMINFO="/usr/share/terminfo"

Now, restart your terminal emulator.

This issue is still due to a bug in the build of anaconda/miniconda. The TERMINFO variable is hardcoded in clear binary. By moving the clear to clear_old can help solve this problem, but some applications(e.g bpython) installed by conda still cannot run due to the fact that TERMINFO is a hardcoded and incorrect path.

@brainwave
Copy link

Nice @iteemhe . How did you find this, if I may ask?

@LeileiChui
Copy link

This issue is likely caused by the lack of TERMINFO environment variable. The path to TERMINFO in most Linux system is /usr/share/terminfo. But you need to manually check if the path exists, or it is under another path.

Then, in your .zshrc or .bashrc, include this line.

export TERMINFO="/usr/share/terminfo"

Now, restart your terminal emulator.

This issue is still due to a bug in the build of anaconda/miniconda. The TERMINFO variable is hardcoded in clear binary. By moving the clear to clear_old can help solve this problem, but some applications(e.g bpython) installed by conda still cannot run due to the fact that TERMINFO is a hardcoded and incorrect path.

Worked for me, thanks

yugt added a commit to yugt/bestbash that referenced this issue Sep 21, 2022
aebruno added a commit to ubccr/software-layer that referenced this issue Jan 14, 2023
When loading anaconda3 module hit an issue with the terminfo/termcap
files. [This issue](ContinuumIO/anaconda-issues#331)
summarizes it nicely and the fix is to set TERMINFO env var.

This commit adds a hook to set TERMINFO in the anaconda module file.
@Forence1999
Copy link

conda install ncurses=6.3

solved my problem, which might be caused by the bug of ncurses=6.4

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

No branches or pull requests