skip to Main Content

I develop our company website with Odoo 14. I installed Odoo on my local machine (macOS Monterey (12.5.1)) via Docker. I use Docker Desktop and I have created docker-compose.yaml taking official Odoo docker image page as reference.

version: '2'
services:
  web:
    image: odoo:14.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - odoo-web-data:/var/lib/odoo©
      - ./config:/etc/odoo
      - ./addons:/mnt/extra-addons
  db:
    image: postgres:10
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
      - ./db:/db
volumes:
  odoo-web-data:
  odoo-db-data:

I wanted to install Odoo eCommerce module but I couldn’t. It gives that error:

Unable to install module "account_edi_proxy_client" because an
external dependency is not met: Python library not installed:
cryptography

I already installed it but it still gives the same error.

$ pip3 install cryptography
Requirement already satisfied: cryptography in /usr/local/lib/python3.10/site-packages (38.0.4)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/site-packages (from cryptography) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.10/site-packages (from cffi>=1.12->cryptography) (2.21)

There were some suggestion to install pycryptodome instead, I installed it as well but still the same result.

After all, I realised that I was trying installing cryptography library on my local machine and actually I had to install it in the docker container.

So, I ran this command:

docker exec -it [container_name] pip3 install cryptography

and I got this error now:

Command "/usr/bin/python3 -m pip install –ignore-installed –no-user –prefix /tmp/pip-build-env-ynyd_o0_ –no-warn-script-location –no-binary :none: –only-binary :none: -i https://pypi.org/simple — setuptools>=40.6.0,!=60.9.0 wheel "cffi>=1.12; platform_python_implementation != ‘PyPy’" setuptools-rust>=0.11.4" failed with error code 1 in None

What is missing here, any idea?

2

Answers


  1. Chosen as BEST ANSWER

    Alternative to @Waleed's solution, there is another way to install cryptography (or another) library into docker container. The difference here is creating a Dockerfile and configure the docker-compose.yaml.

    docker-compose.yaml:

    version: '3.9'
    services:
      web:
        build:
          context: ./
          dockerfile: Dockerfile
        depends_on:
          - db
        ports:
          - "8069:8069"
        volumes:
          - odoo-web-data:/var/lib/odoo©
          - ./config:/etc/odoo
          - ./addons:/mnt/extra-addons
      db:
        image: postgres:10
        environment:
          - POSTGRES_DB=postgres
          - POSTGRES_PASSWORD=odoo
          - POSTGRES_USER=odoo
          - PGDATA=/var/lib/postgresql/data/pgdata
        volumes:
          - odoo-db-data:/var/lib/postgresql/data/pgdata
          - ./db:/db
    volumes:
      odoo-web-data:
      odoo-db-data:
    

    I copied the Dockerfile (v14) from the official Odoo github page and additionally, I declared to install cryptography library (python3-cryptography).

    Dockerfile:

    FROM debian:buster-slim
    LABEL Odoo S.A. <[email protected]>
    
    SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
    
    # Generate locale C.UTF-8 for postgres and general locale data
    ENV LANG C.UTF-8
    
    # Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
    RUN apt-get update && 
        apt-get install -y --no-install-recommends 
            ca-certificates 
            curl 
            dirmngr 
            fonts-noto-cjk 
            gnupg 
            libssl-dev 
            node-less 
            npm 
            python3-num2words 
            python3-pdfminer 
            python3-pip 
            python3-phonenumbers 
            python3-pyldap 
            python3-qrcode 
            python3-renderpm 
            python3-setuptools 
            python3-slugify 
            python3-vobject 
            python3-watchdog 
            python3-xlrd 
            python3-xlwt 
            python3-cryptography 
            xz-utils 
        && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb 
        && echo 'ea8277df4297afc507c61122f3c349af142f31e5 wkhtmltox.deb' | sha1sum -c - 
        && apt-get install -y --no-install-recommends ./wkhtmltox.deb 
        && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
    
    # install latest postgresql-client
    RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list 
        && GNUPGHOME="$(mktemp -d)" 
        && export GNUPGHOME 
        && repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' 
        && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" 
        && gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc 
        && gpgconf --kill all 
        && rm -rf "$GNUPGHOME" 
        && apt-get update  
        && apt-get install --no-install-recommends -y postgresql-client 
        && rm -f /etc/apt/sources.list.d/pgdg.list 
        && rm -rf /var/lib/apt/lists/*
    
    # Install rtlcss (on Debian buster)
    RUN npm install -g rtlcss
    
    # Install Odoo
    ENV ODOO_VERSION 14.0
    ARG ODOO_RELEASE=20221226
    ARG ODOO_SHA=ec385462138e5027be4cf452844a3df3a8ef3573
    RUN curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb 
        && echo "${ODOO_SHA} odoo.deb" | sha1sum -c - 
        && apt-get update 
        && apt-get -y install --no-install-recommends ./odoo.deb 
        && rm -rf /var/lib/apt/lists/* odoo.deb
    
    # Copy entrypoint script and Odoo configuration file
    # COPY ./entrypoint.sh /
    COPY ./config/odoo.conf /etc/odoo/
    
    # Set permissions and Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
    RUN chown odoo /etc/odoo/odoo.conf 
        && mkdir -p /mnt/extra-addons 
        && chown -R odoo /mnt/extra-addons
    VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
    
    # Expose Odoo services
    EXPOSE 8069 8071 8072
    
    # Set the default config file
    ENV ODOO_RC /etc/odoo/odoo.conf
    
    # COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
    
    # Set default user when running the container
    USER odoo
    
    # ENTRYPOINT ["/entrypoint.sh"]
    CMD ["odoo"]
    

  2. Try to upgrade pip and setuptools first and then install cryptography

    docker exec -it CONTAINER_ID pip3 install --upgrade pip
    docker exec -it CONTAINER_ID pip3 install --upgrade setuptools
    
    docker exec -it CONTAINER_ID pip3 install cryptography
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search