title: pathlib: cannot import name 'Sequence' from 'collections'
body: <p>It has been a few days since I rebuilt my project but when I was testing some things this morning I wanted to update my Werkzeug package due to an issue I was having with its Multidict class, I rebuilt and started getting this error:</p>
  <pre><code>#17 73.14     ERROR: Command errored out with exit status 1:
  #17 73.14      command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'/tmp/pip-install-0qw1gt47/pathlib_cc19f11e095d4bbd895469d77780e6c9/setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'/tmp/pip-install-0qw1gt47/pathlib_cc19f11e095d4bbd895469d77780e6c9/setup.py'&quot;'&quot;';f = getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__) if os.path.exists(__file__) else io.StringIO('&quot;'&quot;'from setuptools import setup; setup()'&quot;'&quot;');code = f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' egg_info --egg-base /tmp/pip-pip-egg-info-908_ate4
  #17 73.14          cwd: /tmp/pip-install-0qw1gt47/pathlib_cc19f11e095d4bbd895469d77780e6c9/
  #17 73.14     Complete output (13 lines):
  #17 73.14     Traceback (most recent call last):
  #17 73.14       File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  #17 73.14       File &quot;/usr/local/lib/python3.10/site-packages/setuptools/__init__.py&quot;, line 16, in &lt;module&gt;
  #17 73.14         import setuptools.version
  #17 73.14       File &quot;/usr/local/lib/python3.10/site-packages/setuptools/version.py&quot;, line 1, in &lt;module&gt;
  #17 73.14         import pkg_resources
  #17 73.14       File &quot;/usr/local/lib/python3.10/site-packages/pkg_resources/__init__.py&quot;, line 23, in &lt;module&gt;
  #17 73.14         import zipfile
  #17 73.14       File &quot;/usr/local/lib/python3.10/zipfile.py&quot;, line 19, in &lt;module&gt;
  #17 73.14         import pathlib
  #17 73.14       File &quot;/tmp/pip-install-0qw1gt47/pathlib_cc19f11e095d4bbd895469d77780e6c9/pathlib.py&quot;, line 10, in &lt;module&gt;
  #17 73.14         from collections import Sequence
  #17 73.14     ImportError: cannot import name 'Sequence' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
  #17 73.14     ----------------------------------------
  #17 73.14 WARNING: Discarding https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz#sha256=6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f (from https://pypi.org/simple/pathlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  #17 73.14 ERROR: Could not find a version that satisfies the requirement pathlib==1.0.1 (from versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.97, 1.0, 1.0.1)
  #17 73.14 ERROR: No matching distribution found for pathlib==1.0.1
  </code></pre>
  <p>I attempted to install the dependencies requirements.txt on my local machine and it ran without any issues, but when the docker image is built it errors</p>
  <p>Docker file:</p>
  <pre><code>FROM python:3
  
  WORKDIR /usr/src/app
  
  COPY . .
  
  RUN pip install --no-cache-dir -r requirements.txt
  
  EXPOSE 5010
  
  RUN chmod u+x ./entrypoint.sh
  </code></pre>
  <p>requirements.txt:</p>
  <pre><code>alembic==1.7.3
  aniso8601==8.0.0
  appdirs==1.4.4
  artifactory==0.1.17
  attrs==20.3.0
  bcrypt==3.2.0
  beautifulsoup4==4.9.3
  bidict==0.21.3
  blinker==1.4
  boto3==1.18.50
  botocore==1.21.50
  bs4==0.0.1
  cachelib==0.3.0
  certifi==2020.12.5
  cffi==1.14.5
  chardet==3.0.4
  click==8.0.1
  cryptography==3.4.6
  distlib==0.3.2
  dnspython==1.16.0
  dominate==2.6.0
  email-validator==1.1.3
  et-xmlfile==1.1.0
  eventlet==0.30.2
  filelock==3.0.12
  Flask==2.0.1
  Flask-Bootstrap==3.3.7.1
  Flask-Login==0.5.0
  Flask-Mail==0.9.1
  flask-marshmallow==0.14.0
  Flask-Migrate==3.1.0
  Flask-RESTful==0.3.8
  Flask-Session==0.4.0
  Flask-SocketIO==5.1.1
  Flask-SQLAlchemy==2.5.1
  Flask-User==1.0.2.2
  Flask-WTF==0.15.1
  greenlet==1.1.0
  gunicorn==20.1.0
  idna==2.10
  iniconfig==1.1.1
  is-safe-url==1.0
  itsdangerous==2.0.1
  Jinja2==3.0.1
  jmespath==0.10.0
  Mako==1.1.5
  MarkupSafe==2.0.1
  marshmallow==3.12.2
  marshmallow-sqlalchemy==0.26.1
  numpy==1.21.0
  openpyxl==3.0.7
  packaging==20.9
  pandas==1.2.5
  paramiko==2.7.2
  passlib==1.7.4
  pexpect==4.8.0
  pluggy==0.13.1
  psycopg2-binary==2.9.1
  ptyprocess==0.7.0
  py==1.10.0
  pycparser==2.20
  PyNaCl==1.4.0
  pyparsing==2.4.7
  pytest==6.2.3
  python-dateutil==2.8.1
  python-dotenv==0.19.0
  python-engineio==4.2.1
  python-socketio==5.4.0
  pytz==2021.1
  requests==2.24.0
  s3transfer==0.5.0
  scp==0.13.3
  shippo==2.0.2
  simplejson==3.17.2
  six==1.15.0
  soupsieve==2.2
  SQLAlchemy==1.4.15
  SQLAlchemy-Utils==0.37.8
  toml==0.10.2
  urllib3==1.25.11
  virtualenv==20.4.7
  visitor==0.1.3
  Werkzeug==2.0.2
  WTForms==2.3.3
  XlsxWriter==1.4.3
  </code></pre>
  <p>I also tried just taking pathlib out of the requirements file so that the other dependencies could install it on their own, which attempted multiple versions of pathlib, but it still errored:</p>
  <pre><code>#9 86.72 ERROR: Could not find a version that satisfies the requirement pathlib (from artifactory) (from versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.97, 1.0, 1.0.1)
  #9 86.72 ERROR: No matching distribution found for pathlib
  </code></pre>
  <p>Any help would be greatly appreciated.</p>