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

conda.sh: line 80: syntax error near unexpected token `(' #7373

Open
1 of 2 tasks
kaaloo opened this issue Jun 4, 2018 · 10 comments
Open
1 of 2 tasks

conda.sh: line 80: syntax error near unexpected token `(' #7373

kaaloo opened this issue Jun 4, 2018 · 10 comments
Labels
cli pertains to the CLI interface stale::recovered [bot] recovered after being marked as stale

Comments

@kaaloo
Copy link

kaaloo commented Jun 4, 2018

I'm submitting a...

  • bug report
  • feature request

Current Behavior

source activate <environment> produces a syntax error

Steps to Reproduce

luis@juno:~$ source activate base
bash: /home/luis/miniconda3/etc/profile.d/conda.sh: line 80: syntax error near unexpected token `('
bash: /home/luis/miniconda3/etc/profile.d/conda.sh: line 80: `conda() {'

Expected Behavior

The specified environment should be activated and the shell prompt should be updated to reflect the name of the environment .

Environment Information

`conda info`


     active environment : None
       user config file : /home/luis/.condarc
 populated config files : 
          conda version : 4.5.1
    conda-build version : not installed
         python version : 3.6.5.final.0
       base environment : /home/luis/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /home/luis/miniconda3/pkgs
                          /home/luis/.conda/pkgs
       envs directories : /home/luis/miniconda3/envs
                          /home/luis/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.1 requests/2.18.4 CPython/3.6.5 Linux/4.15.0-22-lowlatency ubuntu/18.04 glibc/2.27
                UID:GID : 1000:1000
             netrc file : /home/luis/.netrc
           offline mode : False

`conda config --show-sources`

(No output is produced)


`conda list --show-channel-urls`

# packages in environment at /home/luis/miniconda3:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                   py36_0    defaults
ca-certificates           2018.03.07                    0    defaults
certifi                   2018.4.16                py36_0    defaults
cffi                      1.11.5           py36h9745a5d_0    defaults
chardet                   3.0.4            py36h0f667ec_1    defaults
conda                     4.5.1                    py36_0    defaults
conda-env                 2.6.0                h36134e3_1    defaults
cryptography              2.2.2            py36h14c3975_0    defaults
idna                      2.6              py36h82fb2a8_1    defaults
libedit                   3.1                  heed3624_0    defaults
libffi                    3.2.1                hd88cf55_4    defaults
libgcc-ng                 7.2.0                hdf63c60_3    defaults
libstdcxx-ng              7.2.0                hdf63c60_3    defaults
ncurses                   6.0                  h9df7e31_2    defaults
openssl                   1.0.2o               h20670df_0    defaults
pip                       9.0.3                    py36_0    defaults
pycosat                   0.6.3            py36h0a5515d_0    defaults
pycparser                 2.18             py36hf9f622e_1    defaults
pyopenssl                 17.5.0           py36h20ba746_0    defaults
pysocks                   1.6.8                    py36_0    defaults
python                    3.6.5                hc3d631a_0    defaults
readline                  7.0                  ha6073c6_4    defaults
requests                  2.18.4           py36he2e5f8d_1    defaults
ruamel_yaml               0.15.35          py36h14c3975_1    defaults
setuptools                39.0.1                   py36_0    defaults
six                       1.11.0           py36h372c433_1    defaults
sqlite                    3.23.1               he433501_0    defaults
tk                        8.6.7                hc745277_3    defaults
urllib3                   1.22             py36hbe7ace6_0    defaults
wheel                     0.31.0                   py36_0    defaults
xz                        5.2.3                h55aa19d_2    defaults
yaml                      0.1.7                had09818_2    defaults
zlib                      1.2.11               ha838bed_2    defaults

@sebastian-luna-valero
Copy link

In case it helps, as of conda 4.4 there is a new way of activating environments. Please have a look at:
https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20

@kaaloo
Copy link
Author

kaaloo commented Jun 4, 2018

Thanks ! I tried that but I'm getting the same issue even before trying conda activate base

luis@juno:~$ . $HOME/miniconda3/etc/profile.d/conda.sh
bash: /home/luis/miniconda3/etc/profile.d/conda.sh: line 80: syntax error near unexpected token `('
bash: /home/luis/miniconda3/etc/profile.d/conda.sh: line 80: `conda() {'

@kaaloo
Copy link
Author

kaaloo commented Jun 4, 2018

Ok I found the culprit, there is an alias conda="PYTHONNOUSERSITE=1 conda" entry in my .bash_aliases from a workaround to #394 some time ago.

@kaaloo kaaloo closed this as completed Jun 4, 2018
@kalefranz
Copy link
Contributor

Going to reopen this to remind me to make sure we’re properly escaping conda with \.

@kalefranz kalefranz reopened this Jun 4, 2018
@mbargull mbargull added the cli pertains to the CLI interface label Jun 5, 2018
@sritee
Copy link

sritee commented Jun 10, 2018

@kaaloo Instead of an alias, you can use a function if you need it in bashrc file.

anaconda () {
   export PATH="/home/sritee/anaconda3/bin:$PATH";
}

typing anaconda, and then source activate env should work.

@mingwandroid
Copy link
Contributor

@sritee that is not the way to activate conda environments.

@Zyx-A
Copy link

Zyx-A commented Oct 27, 2018

error info:

user@localhost:~$ source anaconda3/bin/activate
bash: /home/user/anaconda3/etc/profile.d/conda.sh: line 80: syntax error near unexpected token `('
bash: /home/user/anaconda3/etc/profile.d/conda.sh: line 80: `conda() {'

fix line 80:

user@localhost:~$ vim +80 anaconda3/etc/profile.d/conda.sh

old:

conda() {

new:

function conda() {

test:

user@localhost:~$ source anaconda3/bin/activate
(base) user@localhost:~$

@fabiovanzella
Copy link

I removed the word "function" in line 5 and line 31 in all files .sh
/home/.../opt/anaconda3/etc/conda/activate.d/*
/home/.../opt/anaconda3/etc/conda/deactivate.d/*

@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue in the latest version of Conda

  2. Comment that the issue is still reproducible and include:

  • What version of Conda you reproduced the issue on
  • What OS and version you reproduced the issue on
  • What steps you followed to reproduce the issue
  1. It would also be helpful to have the output of the following commands available:
  • conda info
  • conda config --show-sources
  • conda list --show-channel-urls

NOTE: If this issue was closed prematurely, please leave a comment and we will gladly reopen the issue.

In case this issue was originally about a project that is covered by the Anaconda issue tracker (e.g. Anaconda, Miniconda, packages built by Anaconda, Inc. like Anaconda Navigator etc), please reopen the issue there again.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Nov 21, 2021
@MatthewTeta
Copy link

I've had this error occur multiple times and I'd never figured out what the proper fix is until today.

Open your .condarc file, remove the parenthesis in the env_prompt string. In fact, I just changed mine to env_prompt: "{name}".

I'm not sure if this will work for everyone, but it worked for me strangely enough.

@github-actions github-actions bot added stale::recovered [bot] recovered after being marked as stale and removed stale [bot] marked as stale due to inactivity labels Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli pertains to the CLI interface stale::recovered [bot] recovered after being marked as stale
Projects
Status: 🆕 New
Development

No branches or pull requests

9 participants