Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket: ModuleNotFoundError: No module named 'numpy'

I'm trying to setup unit tests in Bitbucket using the following bitbucket-pipelines.yml

image: python:3.7.3

pipelines:
  default:
    - step:
      caches:
        - pip
      script: # Modify the commands below to build your repository.
        - pip3 install --upgrade pip setuptools wheel
        - pip3 install -r requirements.txt
    - step:
      script:
        - python3 -m unittest discover -vp 'Test*.py'

The file requirements.txt is the following:

tensorflow==2.4.1
Keras==2.4.3
pandas==1.1.3
requests==2.24.0
matplotlib==3.3.2
numpy==1.19.2

numpy is present in the requirements but when it runs the unit tests, I get the following error:

  import numpy as np
ModuleNotFoundError: No module named 'numpy'

 

1 answer

1 vote

@stefanoc this means , that when you install dependencies, they failed to install. The possible reason is that you freeze version, and some package, for example, pandas, require numpy of another version, BUT you have a conflict here.

Try to install it locally and ensure you have latest pip package manager, they recently did very major update that shows this error, I explained above.

While installing locally, you will see the error or will manually check if the package is installed indeed.

I just tried to install you requirements and got:

```(.venv) ➜ my-dir ✗ pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement tensorflow==2.4.1
ERROR: No matching distribution found for tensorflow==2.4.1

```

So pay attention to this and ensure you have python and pip of required version

Regards, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

74 views 2 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you