Search code examples
pythonmatplotlibcygwinpip

ValueError: semaphore or lock released too many times?


I get ValueError: semaphore or lock released too many times when I try to do pip install matplotlib in Cygwin. What do I do?

UPDATE:

$ pip install matplotlib
Downloading/unpacking matplotlib
  You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
  You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
  Downloading matplotlib-1.3.0.tar.gz (42.1MB): 42.1MB downloaded
  Running setup.py egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.3.0]
                    python: yes [2.7.5 (default, Jul 30 2013, 14:34:22)  [GCC
                            4.8.1]]
                  platform: yes [cygwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.7.1]
                  dateutil: yes [using dateutil version 2.1]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [version 16.1.10]
                       png: yes [version 1.5.14]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt4agg: no  [PyQt4 not found]
    Process PoolWorker-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
        self.run()
      File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
        self._target(*self._args, **self._kwargs)
      File "/usr/lib/python2.7/multiprocessing/pool.py", line 102, in worker
        task = get()
      File "/usr/lib/python2.7/multiprocessing/queues.py", line 378, in get
        rrelease()
    ValueError: semaphore or lock released too many times

Solution

  • I am not sure if it is the issue with a newest (stable) build of matplotlib, but I ran into the same issue as well.

    My solution was to install an older stable version (1.2.1).

    Download the 1.2.1 tar file, unzip, and install. Do not use the cygwin compiler option when installing. i.e.

       python setup.py build --compiler=cygwin
    

    will fail (did for me), while the usual

       python setup.py build
    

    will work. Of course You'll want to follow up with

       python setup.py install
    

    Note: I run a pretty recent cygwin64. I already had all of the dependencies installed. I've also tried installing 1.3.0 through pip as well as source. Both threw the same exact error you described here.