Skip to content

Instantly share code, notes, and snippets.

@vincedgy
Created January 14, 2021 20:54
Show Gist options
  • Save vincedgy/6fdd1e10904e5ff4de16a0f7da34d10a to your computer and use it in GitHub Desktop.
Save vincedgy/6fdd1e10904e5ff4de16a0f7da34d10a to your computer and use it in GitHub Desktop.

On MAC Os BigSur (11.1)

I've being facing issues all day with numpy failing install (with pandas) for Python 3.9.1.6 and poetry 1.1.4.

I understood that poetry uses pip which does not use the wheel version of numpy when pip <= 20.2.x. And fresh installation of Python 3.9.1.6 does not upgrade pip !

This is how I managed to install what I needed :

First check the default version of Python linked to poetry (reinstall it if it does not fit)

poetry env info | grep -i python
Python:         3.9.1
Implementation: CPython
Python:   /usr/local/Cellar/[email protected]/3.9.1_6/Frameworks/Python.framework/Versions/3.9

Install you project and run poetry init without any dependencies you seek (you'll use poetry add <deps> juste after...)

You should obtain something similar to this pyproject.toml :

[tool.poetry]
name = "project1"
version = "0.1.0"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Launch the poetry shell

➜  project1 poetry shell

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).
You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

Spawning shell within /Users/vincent/Library/Caches/pypoetry/virtualenvs/project1-5XOg8Qie-py3.9
➜  project1 . /Users/vincent/Library/Caches/pypoetry/virtualenvs/project1-5XOg8Qie-py3.9/bin/activate
(project1-5XOg8Qie-py3.9) ➜  project1

At this point upgrade pip, wheel and setuptools !

(project1-5XOg8Qie-py3.9) ➜  project1 $ pip install --upgrade pip wheel setuptools
Looking in indexes: https://pypi.python.org/simple/
Collecting pip
  Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Collecting wheel
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting setuptools
  Using cached setuptools-51.1.2-py3-none-any.whl (784 kB)
Installing collected packages: pip, wheel, setuptools
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
  Attempting uninstall: wheel
    Found existing installation: wheel 0.35.1
    Uninstalling wheel-0.35.1:
      Successfully uninstalled wheel-0.35.1
  Attempting uninstall: setuptools
    Found existing installation: setuptools 50.3.2
    Uninstalling setuptools-50.3.2:
      Successfully uninstalled setuptools-50.3.2
Successfully installed pip-20.3.3 setuptools-51.1.2 wheel-0.36.2

Now installation should be ok

(project1-5XOg8Qie-py3.9) ➜  project1 poetry install
Installing dependencies from lock file

Package operations: 5 installs, 0 updates, 0 removals

  - Installing six (1.15.0)
  - Installing numpy (1.19.5)
  - Installing python-dateutil (2.8.1)
  - Installing pytz (2020.5)
  - Installing pandas (1.2.0)

Installing the current project: project1 (0.1.0)

Yeepee !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment