I have created the docker image to run python script. Now when I run below command it throwing error.
command in powershell:
docker build -t pull_request_summary .
Error:
Traceback (most recent call last):
File "/usr/app/src/./listPullRequest.py", line 1, in
import requests
ModuleNotFoundError: No module named 'requests'
Just to confirm the "requests module is already installed on my machine. The script is running fine if I directly run from PowerShell. It just throwing error while running docker images.
My question is where it is expecting the "request" module of python?
your container also must have requests installed on it
In your docker file put this line
RUN pip install requests
I had this same error even when including RUN pip install requests in the Dockerfile. My solution was to change from:
CMD ./myscript.py
to:
CMD [ "python", "./myscript.py" ]
Related
I am trying to run tensorboard in docker container.
Here are parts of my dockerfile:
# get base image
FROM tensorflow/tensorflow:2.2.0-gpu
...
# install tensorboard
RUN pip install tensorboard
RUN pip install -U tensorboard_plugin_profile
However, when I start tensorboard in the container with
tensorboard --logdir '/log/' --host 0.0.0.0
it returns following error:
E1203 10:17:24.945772 140395295995712 application.py:260] Failed to load plugin ProfilePluginLoader.load; ignoring it.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorboard/backend/application.py", line 255, in TensorBoardWSGIApp
plugin = loader.load(context)
File "/usr/local/lib/python3.6/dist-packages/tensorboard_plugin_profile/profile_plugin_loader.py", line 75, in load
from tensorboard_plugin_profile import profile_plugin
File "/usr/local/lib/python3.6/dist-packages/tensorboard_plugin_profile/profile_plugin.py", line 32, in <module>
from tensorboard.context import RequestContext
ModuleNotFoundError: No module named 'tensorboard.context'
When not using RUN pip install -U tensorboard_plugin_profile I don't get the error, however I can't use the tensorflow profiler then. The tensorboard page suggested using pip install -U tensorboard_plugin_profile
I would really appreciate your help!
I'm not able to run a Python script from ExecuteStreamCommand.
These are the processor properties:
Command arguments: /home/directory/test.py
Command path: /bin/python3
Working directory: /home/directory
Error message: Traceback (most recent call last): File "/home/test.py", line 1, in import nipyapi ModuleNotFoundError: No module named 'nipyapi'
The way that I am able to get ExecuteStreamCommand processor to run python scripts with imported modules is to install the imported modules on the actual machine itself. Therefore, this means running pip or pip3 install {insert module name} on the command prompt for each system that this processor is running on.
I have this error when running the script from terminal but works from PyCharm
C:\Users\Username\PycharmProjects\Space Invaders>python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
This is how my file directory looks:
https://i.stack.imgur.com/s9qB5.png
I am using python 3.8 and pygame 2.0.1
Should I have to install pygame globally for me to run the script from command line? I have the package installed in a virtual environment.
You're trying to execute the script with global python which doesn't have the pygame package installed. So, you have to activate the virtual environment first. To do this, go to venv/Scripts/ and there will be an "activate" file that you need to execute. Once you have done this you can run your script and it should work.
More info on: https://docs.python.org/3/tutorial/venv.html
Running on a Raspberry Pi 3 Model B V1.2, trying to get a python script to run that will upload files to AWS S3 buckets so I can pull them down from elsewhere later after running it through rekognition.
However, when I try to run the python script outside of the development environment I get
Traceback (most recent call last):
File "/home/pi/file.py", line 2, in <module>
import boto3
ModuleNotFoundError: No module named "boto3"
I've spent about 2 hours finding a resolution, including using commands like pip install boto3 and python -m pip install --user boto3
I'm unsure of what fixes I can do at this point.
EDIT: It seems like its not installing boto3 to the device, any fixes for this?
I have some trouble to start and run localstack. I can install localstack relatively easy with "pip install localstack". This worked for me without problems. After the installation I tried to start localstack with "localstack start" but then windows tells me it can't find localstack.
The command "localstack" is either misspelled or could not be found.
I searched a lot and found out there are some similar problems. In one issue I found something that could eventually work for me. In this question. Because I never worked with python this is a little bit confusing for me. I tried this answer. I switched into the python scripts folder and run the command "py localstack start". Here it is interesting, that I get an error again, but this time windows recognizes localstack.
This here is the error
Traceback (most recent call last):
File "localstack", line 31, in <module>
from localstack.utils import cli
File "c:\users\gion rubitschung\appdata\local\programs\python\python37\lib\site-packages\localstack\utils\cli.py", line 4, in <module>
from localstack.services import infra
File "c:\users\gion rubitschung\appdata\local\programs\python\python37\lib\site-packages\localstack\services\infra.py", line 20, in <module>
from localstack.utils import common, persistence
File "c:\users\gion rubitschung\appdata\local\programs\python\python37\lib\site-packages\localstack\utils\common.py", line 5, in <module>
import pty
File "c:\users\gion rubitschung\appdata\local\programs\python\python37\lib\pty.py", line 11, in <module>
import tty
File "c:\users\gion rubitschung\appdata\local\programs\python\python37\lib\tty.py", line 5, in <module>
from termios import *
ModuleNotFoundError: No module named 'termios'
How can I start localstack just by typing "localstack start"?
Install the 0.9.0 version with:
python -m pip install localstack==0.9.0
(First you have to uninstall the latest one.)
From localstack's issues.
You can install it directly from the Commandeer App. It uses docker under the hood.
Another way to install Localstack on Windows is by using Docker. Here are the steps:
Install Docker. Instructions given in the post below:
https://softwaredevelopercentral.blogspot.com/p/blog-page_1.html
Pull the latest LocalStack Docker Image using the command below:
$ docker pull localstack/localstack
Start LocalStack using the command below:
$ docker run --rm -p 4566:4566 -p 4571:4571 localstack/localstack
All these instructions are mentioned in the blog post below:
https://softwaredevelopercentral.blogspot.com/p/how-to-install-localstack-on-windows.html