Can't install jpeg because conflicting ports are active: libjpeg-turbo
Question: I am running into an issue with libjpeg-turbo trying to install vsftpd with
Mac Ports. I'm running on OS X 10.10.5.

    
    
    David-Laxers-MacBook-Pro:phoenix_pipeline davidlaxer$ conda -V
    conda 3.16.0
    
    David-Laxers-MacBook-Pro:phoenix_pipeline davidlaxer$ java -version
    java version "1.8.0_05"
    Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
    David-Laxers-MacBook-Pro:phoenix_pipeline davidlaxer$ 
    
        David-Laxers-MacBook-Pro:phoenix_pipeline davidlaxer$ port -v
    MacPorts 2.3.3
    sudo port install vsftpd
    Password:
    --->  Fetching archive for vsftpd
    --->  Attempting to fetch vsftpd-3.0.2_1.darwin_14.x86_64.tbz2 from http://packages.macports.org/vsftpd
    --->  Attempting to fetch vsftpd-3.0.2_1.darwin_14.x86_64.tbz2.rmd160 from http://packages.macports.org/vsftpd
    --->  Installing vsftpd @3.0.2_1
    --->  Activating vsftpd @3.0.2_1
    
    To configure vsftpd edit /opt/local/etc/vsftpd.conf.
    
    --->  Cleaning vsftpd
    --->  Updating database of binaries
    --->  Scanning binaries for linking errors
    --->  Found 99 broken file(s), matching files to ports   
    --->  Found 14 broken port(s), determining rebuild order
    --->  Rebuilding in order
         tiff @4.0.4 
         gd2 @2.1.1 +x11
         ghostscript @9.16 +x11
         djvulibre @3.5.27 
         webp @0.4.3 
         jasper @1.900.1 
         gdk-pixbuf2 @2.31.6 +x11
         opencv @3.0.0 
         lcms @1.19 
         libmng @1.0.10 
         netpbm @10.71.02 +x11
         lcms2 @2.7 
         ImageMagick @6.9.0-0 +x11
         poppler @0.35.0 
    
    Error: Unable to exec port: Can't install jpeg because conflicting ports are active: libjpeg-turbo
    Error rebuilding tiff
        while executing
    "error "Error rebuilding $portname""
        (procedure "revupgrade_scanandrebuild" line 395)
        invoked from within
    "revupgrade_scanandrebuild broken_port_counts $opts"
        (procedure "macports::revupgrade" line 5)
        invoked from within
    "macports::revupgrade $opts"
        (procedure "action_revupgrade" line 2)
        invoked from within
    "action_revupgrade $action $portlist $opts"
        (procedure "action_target" line 96)
        invoked from within
    "$action_proc $action $portlist [array get global_options]"
        (procedure "process_cmd" line 103)
        invoked from within
    "process_cmd $remaining_args"
        invoked from within
    "if { [llength $remaining_args] > 0 } {
    
        # If there are remaining arguments, process those as a command
        set exit_status [process_cmd $remaining..."
        (file "/opt/local/bin/port" line 5268)
    

I had what could be a similar problem earlier today with python-goose:

    
    
    David-Laxers-MacBook-Pro:python-goose davidlaxer$ anaconda search -t conda libjpg
    Traceback (most recent call last):
     File "/users/davidlaxer/anaconda/bin/anaconda", line 6, in <module>
       sys.exit(main())
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/scripts/cli.py", line 94, in main
       description=__doc__, version=version)
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/scripts/cli.py", line 60, in binstar_main
       add_subparser_modules(parser, sub_command_module, 'conda_server.subcommand')
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/clyent/__init__.py", line 117, in add_subparser_modules
       for command_module in get_sub_commands(module):
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/clyent/__init__.py", line 106, in get_sub_commands
       this_module = __import__(module.__package__ or module.__name__, fromlist=names)
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/commands/notebook.py", line 13, in <module>
       from binstar_client.utils.notebook import Uploader, Downloader, parse, notebook_url, has_environment
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/utils/notebook/__init__.py", line 10, in <module>
       from .uploader import *
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/utils/notebook/uploader.py", line 7, in <module>
       from .data_uri import data_uri_from
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/binstar_client/utils/notebook/data_uri.py", line 10, in <module>
       from PIL import Image
     File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/PIL/Image.py", line 63, in <module>
       from PIL import _imaging as core
    ImportError: dlopen(/Users/davidlaxer/anaconda/lib/python2.7/site-packages/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
     Referenced from: /Users/davidlaxer/anaconda/lib/python2.7/site-packages/PIL/_imaging.so
     Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    

Continuum Analytics gave me these instructions (which resolved the 'goose'
problem):

    
    
    conda install -f pillow jpeg
    I was unable to find any details of a jpeg package that has _imaging.so 13. My suggestion from here may be to reinstall goose. I did so by the following. first download the zip from https://github.com/grangier/python-goose and run the following individually.
    
    conda create -n goose python=2.7 anaconda-client pillow lxml cssselect nltk
    
    source activate goose
    
    pip install -i https://pypi.anaconda.org/pypi/simple jieba
    
    conda install -fc https://conda.anaconda.org/auto beautifulsoup4
    Then move the contents of the python-goose-develop/ into the goose environment, similar to this.
    
    cp ~/Downloads/python-goose-develop/* ~/anaconda/envs/goose
    
    cd ~/anaconda/envs/goose
    
    python setup.py install
    

In response to the 'answer' below from dsgfdg.

    
    
    David-Laxers-MacBook-Pro:phoenix_pipeline davidlaxer$ sudo !!
    sudo port install webp
    --->  Computing dependencies for webp
    Error: Unable to execute port: Can't install jpeg because conflicting ports are active: libjpeg-turbo
    

I downloaded Pillow 2.3.1 and built it. It build successfully but then fails
the tests. Here's an excerpt.

    
    
    David-Laxers-MacBook-Pro:Pillow-2.3.1 davidlaxer$ python Tests/run.py
    --------------------------------------------------------------------
    running test_000_sanity ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_000_sanity.py", line 5, in <module>
        import PIL.Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    running test_001_archive ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_001_archive.py", line 2, in <module>
        import PIL.Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    running test_file_bmp ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_file_bmp.py", line 3, in <module>
        from PIL import Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    running test_file_eps ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_file_eps.py", line 3, in <module>
        from PIL import Image, EpsImagePlugin
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    running test_file_fli ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_file_fli.py", line 3, in <module>
        from PIL import Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    running test_file_gif ...
    === error 256
    Traceback (most recent call last):
      File "Tests/test_file_gif.py", line 3, in <module>
        from PIL import Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    

...

ImportError: dlopen(/Users/davidlaxer/.python-
eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2):
Library not loaded: libjpeg.8.dylib Referenced from:
/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-
tmp/PIL/_imaging.so Reason: Incompatible library version: _imaging.so requires
version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
\-------------------------------------------------------------------- *** 94
tests of 94 failed. David-Laxers-MacBook-Pro:Pillow-2.3.1 davidlaxer$

    
    
    David-Laxers-MacBook-Pro:scraper davidlaxer$ python scraper.py
    Traceback (most recent call last):
      File "scraper.py", line 8, in <module>
        from goose import Goose
      File "/users/davidlaxer/anaconda/lib/python2.7/site-packages/goose/__init__.py", line 27, in <module>
        from goose.crawler import CrawlCandidate
      File "/users/davidlaxer/anaconda/lib/python2.7/site-packages/goose/crawler.py", line 31, in <module>
        from goose.images.extractors import UpgradedImageIExtractor
      File "/users/davidlaxer/anaconda/lib/python2.7/site-packages/goose/images/extractors.py", line 28, in <module>
        from goose.images.utils import ImageUtils
      File "/users/davidlaxer/anaconda/lib/python2.7/site-packages/goose/images/utils.py", line 26, in <module>
        from PIL import Image
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/Image.py", line 53, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 7, in <module>
      File "build/bdist.macosx-10.5-x86_64/egg/PIL/_imaging.py", line 6, in __bootstrap__
    ImportError: dlopen(/Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so, 2): Library not loaded: libjpeg.8.dylib
      Referenced from: /Users/davidlaxer/.python-eggs/Pillow-2.3.1-py2.7-macosx-10.5-x86_64.egg-tmp/PIL/_imaging.so
      Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
    


Answer: The problem is that both the `libjpeg-turbo` and the `jpeg` port in MacPorts
provide `libjpeg.dylib` and corresponding headers (consequently, they conflict
with each other and cannot be installed simultaneously), but the `jpeg` port
ships `libjpeg.9.dylib`, which is ABI-incompatible with `libjpeg-turbo`'s
`libjpeg.8.dylib`.

The problem is not caused by the installation of the `vsftpd` port; rather,
MacPorts runs a sanity check after each installation or update called `rev-
upgrade` that checks for ABI compatibility issues such as referencing non-
existant or incompatible libraries. When it detects such issues (as in your
case), it attempts to rebuild the broken ports to fix the issues.

This sanity checks determines that your `tiff` port is broken, because one of
its binaries or libraries links against `libjpeg.9.dylib` \-- this file
doesn't exist because it is provided by the `jpeg` port, but you only have
`libjpeg-turbo` installed. The rebuild then attempts to install the `jpeg`
port as a dependency of `tiff` and fails because of the conflict.

You have multiple options at this point:

  * Uninstall `libjpeg-turbo` and install `jpeg`. That should fix your issues, but is only an option if you don't explicitly want `libjpeg-turbo` for some reason.
  * Uninstall all ports that explicitly depend on the `jpeg` port and rebuild those that will accept `libjpeg-turbo` as a provider of the `libjpeg.dylib` library; unfortunately, the `tiff` port is currently not among them: 
    
        $> port info --depends_lib tiff
    depends_lib: port:jpeg, port:xz, port:zlib

This would contain `path:lib/libjpeg.dylib:jpeg` if it supported both
versions. A quick survey suggests only very few ports in MacPorts currently
support `libjpeg-turbo` to provide JPEG functionality. This may change in the
future (and in fact, there was a discussion about that recently on the mailing
lists).

**TL;DR:**

    
    
    sudo port -f uninstall libjpeg-turbo
    sudo port install jpeg
    sudo port rev-upgrade
    

