conda ValueError: failed to parse Cpython sys.version - python

I am trying to install Anaconda (32-bit) over an existing Python environment (32-bit) on a Windows 7 64-bit system. I am able to get Anaconda python environment running, but the navigator won't respond and conda command fails with an error
ValueError: failed to parse CPython sys.version
I have removed C:\Python27; C:\Python27\Scripts; from PATH variable, but I must be missing something!
C:\Users\gaurav>python
Python 2.7.13 |Anaconda 4.3.0 (32-bit)| (default, Dec 19 2016, 13:36:02) [MSC v.
1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> quit()
C:\Users\gaurav>conda
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Traceback (most recent call last):
File "C:\Users\gaurav\Anaconda2\Scripts\conda-script.py", line 5, in <module>
sys.exit(conda.cli.main())
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\cli\main.py", line 167
, in main
return conda_exception_handler(_main, *args)
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\exceptions.py", line 6
33, in conda_exception_handler
print_unexpected_error_message(e)
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\exceptions.py", line 5
60, in print_unexpected_error_message
info_stdout, info_stderr = get_info()
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\exceptions.py", line 5
30, in get_info
args.func(args, p)
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\cli\main_info.py", lin
e 142, in execute
from conda.api import get_index
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\api.py", line 1, in <m
odule>
from .core.index import get_index
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\core\index.py", line 2
2, in <module>
from .package_cache import PackageCache
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\core\package_cache.py"
, line 9, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\core\path_actions.py",
line 32, in <module>
from ..gateways.download import download
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\gateways\download.py",
line 15, in <module>
from ..connection import CondaSession
File "C:\Users\gaurav\Anaconda2\lib\site-packages\conda\connection.py", line 5
5, in <module>
python=platform.python_implementation(),
File "C:\Python27\Lib\platform.py", line 1460, in python_implementation
return _sys_version()[0]
File "C:\Python27\Lib\platform.py", line 1422, in _sys_version
repr(sys_version))
ValueError: failed to parse CPython sys.version: '2.7.13 |Anaconda 4.3.0 (32-bit
)| (default, Dec 19 2016, 13:36:02) [MSC v.1500 32 bit (Intel)]'
C:\Users\gaurav>

I was only updating the system environment variable PATH, and was not touching PythonPath, which was set to C:\Python27. This was the cause for that ValueError. I found my solution in this stackoverflow answer.

Related

TensorFlow error: funcsigs module doesn't have signature attribute

I have installed TensorFlow and wanted to check the installation. Here is the interaction with the python console.
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 106, in <module>
from tensorflow.python.platform import test
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/platform/test.py", line 81, in <module>
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/mock.py", line 81, in <module>
inspectsignature = funcsigs.signature
AttributeError: 'module' object has no attribute 'signature'
>>>
Could anyone please tell what I am doing wrong? Thanks.
As Yaroslav noted, this is most likely from running too old a version of Python, or you don't have the funcsigs package installed. For the latter, try pip install funcsigs

Managed to break my venv; is it possible to fix?

I managed to break one of my virtual environments. I think I did it by installing pycrypto with pip and uninstalling it with easy_install.
This is what I get when I run python in the venv.
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$ python
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in <module>
import os
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 49, in <module>
import posixpath as path
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 17, in <module>
import warnings
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.py", line 8, in <module>
import types
File "types.py", line 1, in <module>
import json
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 3, in <module>
import re
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 280, in <module>
import copy_reg
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.py", line 7, in <module>
from types import ClassType as _ClassType
ImportError: cannot import name ClassType
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$
And outside the venv everything works as expected:
Last login: Tue Apr 7 22:30:08 on ttys005
filip#dratmac:~$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How can I fix this?
You should not name your file types.py as there is a standard library module with the same name (import types).
As such, Python tries to import it as part of some standard library code but it now actually imports your local types.py file, not the module it expects.
So the problem should be fixed when you rename types.py to something else.

keep getting 'ImportError: No module named pygtk' when I try to run Gaphor on windows

I have installed pygtk-all-in-one-2.24.0.win32-py2.7.msi on windows, and installed gaphor by easy_install. When I try to run gaphor, I receive an import error.
PS C:\Python27\Scripts> .\gaphor.exe
Traceback (most recent call last):
File "C:\Python27\Scripts\gaphor-script.py", line 9, in <module>
load_entry_point('gaphor==0.17.2', 'console_scripts', 'gaphor')()
File "build\bdist.win32\egg\pkg_resources\__init__.py", line 521, in load_entry_point
File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2632, in load_entry_point
File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2312, in load
File "build\bdist.win32\egg\pkg_resources\__init__.py", line 2318, in resolve
File "C:\Python27\lib\site-packages\gaphor-0.17.2-py2.7.egg\gaphor\__init__.py", line 13, in <module>
import pygtk
ImportError: No module named pygtk
Any suggestions would be appreciated!
Did you actually install pygtk? I suspect easy-install should have pulled it in automatically. Did you see any errors during the install? pygtk also requieres installing gtk+.
Do a simple test - start Python in a console (ipython?), and type:
$ python
Python 2.7.6 (default, May 6 2014, 10:57:58)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> import gtk
>>>
There should be no error messages.
You can also search the disk for pygtk.py (with the file manager) and for a directory gtk-2.0 or gtk-3.0.

scipy with enthought canopy

I am evaluating the Enthought package. I installed the 32bit canopy (downloaded from https://www.enthought.com/downloads/) in Ubuntu.
$ sudo bash canopy-1.0.1-rh5-32.sh
Upon testing I don't see scipy in /usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages:
$ /usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/bin/python
Enthought Canopy Python 2.7.3 | 32-bit | (default, Mar 25 2013, 15:45:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
>>> from pylab import*
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/matplotlib/pylab.py", line 265, in <module>
from matplotlib.pyplot import *
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/matplotlib/pyplot.py", line 97, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/matplotlib/backends/backend_wxagg.py", line 23, in <module>
import backend_wx # already uses wxversion.ensureMinimal('2.8')
File "/usr/local/Canopy/appdata/canopy-1.0.0.1160.rh5-x86/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py", line 52, in <module>
raise ImportError(missingwxversion)
ImportError: Matplotlib backend_wx and backend_wxagg require wxversion, which was not found.
Please help me: how can install the Python Canopy (including scipy, matplotlib etc.)? Do I have to manually install them? I thought the installer shell script installed all these automatically. Am I missing something?
$ uname -a
Linux sree 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux
Scipy is installed into a different virtual environment (~/Enthought/Canopy_64bit/System/). In general, you should be running the Python available at ~/Enthought/Canopy_64bit/User/bin/python as described here. Also look at this article for information on how to make Canopy your default Python

unable to get parallel python (pp) running on python 2.7

I am working on windows box with 8 processors. I have to run a python script that does mass data processing. When run as such, the script uses only one processor. I learnt that, to harness the power of multiple processors, I can use parallel python (pp) library.
I installed the library on my machine and followed the instructions available at http://www.parallelpython.com/content/view/15/30/#QUICKSMP
However, the code to configure pp fails on my machine:
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pp
>>> job_server = pp.Server()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
job_server = pp.Server()
File "C:\Python27\lib\site-packages\pp.py", line 343, in __init__
self.set_ncpus(ncpus)
File "C:\Python27\lib\site-packages\pp.py", line 503, in set_ncpus
range(ncpus - len(self.__workers))])
File "C:\Python27\lib\site-packages\pp.py", line 148, in __init__
self.start()
File "C:\Python27\lib\site-packages\pp.py", line 161, in start
self.pid = int(self.t.receive())
File "C:\Python27\lib\site-packages\pptransport.py", line 134, in receive
msg_len = struct.unpack("!Q", size_packed)[0]
error: unpack requires a string argument of length 8
>>>
Can you please tell me how do I get this resolved? I have installed pp version 1.6.0

Categories

Resources