1. The purpose of this post

I would demo how to solve this error when pip install conan

pip install conan
...
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/python3/lib/python3.7/site-packages (from requests<3.0.0,>=2.8.1->conan) (1.25.3)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/python3/lib/python3.7/site-packages (from requests<3.0.0,>=2.8.1->conan) (2.8)
Requirement already satisfied: monotonic>=0.1 in /usr/local/python3/lib/python3.7/site-packages (from fasteners>=0.14.1->conan) (1.5)
Requirement already satisfied: isort<5,>=4.2.5 in /usr/local/python3/lib/python3.7/site-packages (from pylint!=2.3.0,>=1.9.3->conan) (4.3.21)
Requirement already satisfied: mccabe<0.7,>=0.6 in /usr/local/python3/lib/python3.7/site-packages (from pylint!=2.3.0,>=1.9.3->conan) (0.6.1)
Requirement already satisfied: typed-ast>=1.3.0; implementation_name == "cpython" in /usr/local/python3/lib/python3.7/site-packages (from astroid>=1.6.5->conan) (1.4.0)
Requirement already satisfied: lazy-object-proxy in /usr/local/python3/lib/python3.7/site-packages (from astroid>=1.6.5->conan) (1.4.2)
Requirement already satisfied: wrapt in /usr/local/python3/lib/python3.7/site-packages (from astroid>=1.6.5->conan) (1.11.2)
Requirement already satisfied: packaging in /usr/local/python3/lib/python3.7/site-packages (from deprecation<2.1,>=2.0->conan) (19.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/python3/lib/python3.7/site-packages (from Jinja2<3,>=2.3->conan) (1.1.1)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/python3/lib/python3.7/site-packages (from packaging->deprecation<2.1,>=2.0->conan) (2.4.2)
Requirement already satisfied: attrs in /usr/local/python3/lib/python3.7/site-packages (from packaging->deprecation<2.1,>=2.0->conan) (19.1.0)

2. Environments

  • Python 3.7 system default

3. Solution and Code

Try run pip with –target to specify the python site-packages directory.

pip install --target=/usr/local/python3/lib/python3.7/site-packages conan

If you still get the following error:

WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/Jinja2-2.10.1.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/dateutil already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/python_dateutil-2.8.0.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/bottle.py already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/bottle-0.12.17.dist-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/pluginbase.py already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/pluginbase-0.7-py3.7.egg-info already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/conans already exists. Specify --upgrade to force replacement.
WARNING: Target directory /usr/local/python3/lib/python3.7/site-packages/conan-1.18.2-py3.7.egg-info already exists. Specify --upgrade to force replacement.

You can run pip install as follows:

pip install --target=/usr/local/python3/lib/python3.7/site-packages --upgrade conan

You would get this:

Running setup.py install for PyYAML ... done
Running setup.py install for patch ... done
Running setup.py install for wrapt ... done
Running setup.py install for future ... done
Running setup.py install for pluginbase ... done
Running setup.py install for conan ... done

Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 PyJWT-1.7.1 PyYAML-5.1.2 astroid-2.2.5 attrs-19.1.0 bottle-0.12.17 certifi-2019.6.16 chardet-3.0.4 colorama-0.4.1 conan-1.18.2 deprecation-2.0.7 distro-1.1.0 fasteners-0.15 future-0.16.0 idna-2.8 isort-4.3.21 lazy-object-proxy-1.4.2 mccabe-0.6.1 monotonic-1.5 node-semver-0.6.1 packaging-19.1 patch-1.16 pluginbase-0.7 pygments-2.4.2 pylint-2.3.1 pyparsing-2.4.2 python-dateutil-2.8.0 requests-2.22.0 six-1.12.0 tqdm-4.35.0 typed-ast-1.4.0 urllib3-1.25.3 wrapt-1.11.2