Conan can be installed in many Operating Systems. It has been extensively used and tested in Windows, Linux (different distros), OSX, and is also actively used in FreeBSD and Solaris SunOS. There are also several additional operating systems on which it has been reported to work.
There are three ways to install Conan:
- The preferred and strongly recommended way to install Conan is from PyPI, the Python Package Index, using the
- There are other available installers for different systems, which might come with a bundled python interpreter, so that you don’t have to install python first. Note that some of these installers might have some limitations, especially those created with pyinstaller (such as Windows exe & Linux deb).
- Running Conan from sources.
Install with pip (recommended)¶
To install Conan using
pip, you need Python 2.7 or 3.X distribution installed on your machine. Modern Python distros come
with pip pre-installed. However, if necessary you can install pip by following the instructions in pip docs.
Python 2 will soon be deprecated by the Python maintainers. It is strongly recommended to use Python 3 with Conan, especially if need to manage non-ascii filenames or file contents. Conan still supports Python 2, however some of the dependencies have started to be supported only by Python 3. See Python 2 Deprecation Notice for details.
$ pip install conan
Please READ carefully
- Make sure that your pip installation matches your Python (2.7 or 3.X) version.
- In Linux, you may need sudo permissions to install Conan globally.
- We strongly recommend using virtualenvs (virtualenvwrapper works great) for everything related to Python.
(check https://virtualenvwrapper.readthedocs.io/en/stable/, or https://pypi.org/project/virtualenvwrapper-win/ in Windows)
With Python 3, the built-in module
venvcan also be used instead (check https://docs.python.org/3/library/venv.html). If not using a virtualenv it is possible that conan dependencies will conflict with previously existing dependencies, especially if you are using Python for other purposes.
- In Windows and Python 2.7, you may need to use 32bit python distribution (which is the Windows default), instead of 64 bit.
- In OSX, especially the latest versions that may have System Integrity Protection, pip may fail. Try using virtualenvs, or
install with another user
$ pip install --user conan.
- If you are using Windows and Python <3.5, you may have issues if Python is installed in a path with spaces, such as “C:/Program Files(x86)/Python”. This is a known Python limitation, and is not related to Conan. Try installing Python in a path without spaces, use a virtualenv in another location or upgrade your Python installation.
- Some Linux distros, such as Linux Mint, require a restart (shell restart, or logout/system if not enough) after installation, so Conan is found in the path.
- In Windows, Python 3 installation can fail installing the
wraptdependency because of a bug in pip. Information about this issue and workarounds is available here: https://github.com/GrahamDumpleton/wrapt/issues/112.
- Conan works with Python 2.7, but not all features are available when not using Python 3.x starting with version 1.6
Known installation issues with pip¶
With Python 3.4 the installation sometimes fails with
NameError: name 'implementation_name' is not defined. This issue seems to happen when using pip without a virtual environment. You can fix it by upgrading pip this way:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ python3.4 get-pip.py $ pip install conan
When Conan is installed with pip install --user <username>, usually a new directory is created for it. However, the directory is not appended automatically to the PATH and the conan commands do not work. This can usually be solved restarting the session of the terminal or running the following command:
$ source ~/.profile
Install from brew (OSX)¶
There is a brew recipe, so in OSX, you can install Conan as follows:
$ brew update $ brew install conan
Install from AUR (Arch Linux)¶
The easiest way to install Conan on Arch Linux is by using one of the Arch User Repository (AUR) helpers, e.g., yay, aurman, or pakku.
For example, the following command installs Conan using
$ yay -S conan
Alternatively, build and install Conan manually using
pacman as described in the Arch Wiki.
Conan build files can be downloaded from AUR: https://aur.archlinux.org/packages/conan/.
Make sure to first install the three Conan dependencies which are also found in AUR:
Install the binaries¶
Go to the conan website and download the installer for your platform!
Execute the installer. You don’t need to install python.
Check if Conan is installed correctly. Run the following command in your console:
The response should be similar to:
Consumer commands install Installs the requirements specified in a recipe (conanfile.py or conanfile.txt). config Manages Conan configuration. get Gets a file or list a directory of a given reference or package. info Gets information about the dependency graph of a recipe. ...
If you are using Bash, there is a bash autocompletion project created by the community for Conan commands: https://gitlab.com/akim.saidani/conan-bashcompletion
Install from source¶
You can run Conan directly from source code. First, you need to install Python 2.7 or Python 3 and pip.
Clone (or download and unzip) the git repository and install its requirements:
$ git clone https://github.com/conan-io/conan.git $ cd conan $ pip install -r conans/requirements.txt
Create a script to run Conan and add it to your
#!/usr/bin/env python import sys conan_repo_path = "/home/your_user/conan" # ABSOLUTE PATH TO CONAN REPOSITORY FOLDER sys.path.append(conan_repo_path) from conans.client.command import main main(sys.argv[1:])
You should see the Conan commands help.
If installed via
pip, Conan can be easily updated:
$ pip install conan --upgrade # Might need sudo or --user
If installed via the installers (.exe, .deb), download the new installer and execute it.
The default <userhome>/.conan/settings.yml file, containing the definition of compiler versions, etc., will be upgraded if Conan does not detect local changes, otherwise it will create a settings.yml.new with the new settings. If you want to regenerate the settings, you can remove the settings.yml file manually and it will be created with the new information the first time it is required.
The upgrade shouldn’t affect the installed packages or cache information. If the cache becomes inconsistent somehow, you may want to remove its content by deleting it (<userhome>/.conan).
Python 2 Deprecation Notice¶
All features of Conan until version 1.6 are fully supported in both Python 2 and Python 3. However, new features in upcoming Conan releases that are only available in Python 3 or more easily available in Python 3 will be implemented and tested only in Python 3, and versions of Conan using Python 2 will not have access to that feature. This will be clearly described in code and documentation.
If and when Conan 2.x is released, the level of compatibility with Python 2 may be reduced further.
We encourage you to upgrade to Python 3 as soon as possible. However, if this is impossible for you or your team, we would like to know it. Please give feedback in the Conan issue tracker or write us to firstname.lastname@example.org.