Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SyntaxError: invalid syntax in conda

Now I am not able to run conda or any other programme installed through conda and getting this error : "SyntaxError: invalid syntax"

I have conda installed in my computer(Ubuntu 16.04) with python 2.7 and 3.6.7 (two different virtual environments). Recently I upgraded pip to the latest version. And the the problem began. Initially I faced "Import error". I fixed it by reverting back (uninstall-reinstall) to the older version as suggested here: Error after upgrading pip: cannot import name 'main'

Now I am unable to run pip, conda or anyother programme installed through conda.

This is what I get when I call conda:

(base) mml2@ryzenpc:~$ conda
Traceback (most recent call last):
  File "/home/mml2/miniconda2/bin/conda", line 12, in <module>
    from conda.cli import main
  File "/home/mml2/miniconda2/lib/python3.6/site-packages/conda/__init__.py", line 19, in <module>
    from .common.compat import text_type, iteritems
  File "/home/mml2/miniconda2/lib/python3.6/site-packages/conda/common/compat.py", line 87, in <module>
    from json import JSONDecodeError
  File "/home/mml2/miniconda2/lib/python3.6/json/__init__.py", line 106, in <module>
    from .decoder import JSONDecoder, JSONDecodeError
  File "/home/mml2/miniconda2/lib/python3.6/json/decoder.py", line 3, in <module>
    import re
  File "/home/mml2/miniconda2/lib/python3.6/re.py", line 122, in <module>
    import enum
  File "/home/mml2/Libs/LibsDyogen/enum.py", line 66
    raise NotImplementedError, \
                             ^
SyntaxError: invalid syntax
(base) mml2@ryzenpc:~$ 

Can anyone help me to solve this issue? Please let me know if you need any other details regarding this problem.

like image 848
KG_SOf Avatar asked Jul 08 '26 22:07

KG_SOf


1 Answers

It looks like you are trying to import a python2 library on python3. To avoid confusion with pip, pip2, pip3 etc, just try installing using pip as a method specifying the python interpreter. python3 -m pip install the_lib_you_need

like image 70
alec_djinn Avatar answered Jul 11 '26 12:07

alec_djinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!