简体   繁体   中英

No Such File or directory: requirements.txt

Currently trying to run a script, but I'm getting stuck on a missing requirements.txt.

Here is the.sh file

#!/bin/bash -e
# Copyright 2019 IBM All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if [ -z "$1" ]
  then
    echo "Usage: ./deployCapability.sh <ACTION NAME>"
    exit 1
fi

docker run --rm -v "$PWD:/tmp" ibmfunctions/action-python-v3.7 bash -c "cd /tmp && virtualenv virtualenv && source virtualenv/bin/activate && pip install -r /boxai/requirements.txt"
zip -r $1.zip virtualenv __main__.py ./src/action.py ./src/storage.py config.json ./src/bsk_utils.py ./src/__init__.py
ibmcloud fn action update $1 --kind python:3.7 $1.zip --web true --timeout 600000
date

rm $1.zip

When I run the.sh, I goes through installing setuptools, pip, wheel... done. then it will spit out an error.

Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

Where and what am I doing wrong?

UPDATE: the location of my folder is in the desktop. I also changed the path to /boxai/requirements.txt and /c/users/admin/desktop/boxai/requirements.txt.... No luck.

Thanks

It's hard to know what files are where , but you've mounted some files to /tmp with -v "$PWD:/tmp" , but the file that is missing seems to be /boxai/requirements.txt , which is outside of /tmp

So, maybe you need to add -v "$PWD/requirements.txt:/boxai/requirements.txt" , which assumes you have a requirements.txt in the current directory where you run the shell script.

I also changed the path to /boxai/requirements.txt

If you've downloaded this script from somewhere, I would change it back to what it was before, then remap your local directories into the container accordingly to where it expects files to be in the container, not based on paths on your host.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM