Install python package in docker image from my local directory - python

My goal is to copy the python package from my local directory into docker image and execute an installation inside the image, but I got the error as what we can see below. The image link is for my project file tree.
My Docker File Below:
FROM python:3.10.1-slim
WORKDIR /copyTrading
COPY requirements.txt requirements.txt
COPY ccxt.pro-master/python/ /copyTrading
RUN pip install -e .
RUN pip3 install -r requirements.txt
COPY . .
EXPOSE 80
CMD [ "python", "server2.py"]
------------------------Docker Build Error--------------------------
=> ERROR [5/7] RUN pip install -e . 9.2s
------
> [5/7] RUN pip install -e .:
#9 4.734 Obtaining file:///copyTrading
#9 5.433 ERROR: Command errored out with exit status 1:
#9 5.433 command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/copyTrading/setup.py'"'"'; __file__='"'"'/copyTrading/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-leehc5bu
#9 5.433 cwd: /copyTrading/
#9 5.433 Complete output (7 lines):
#9 5.433 Traceback (most recent call last):
#9 5.433 File "<string>", line 1, in <module>
#9 5.433 File "/copyTrading/setup.py", line 25, in <module>
#9 5.433 with open(package_json, encoding='utf-8') as f:
#9 5.433 File "/usr/local/lib/python3.10/codecs.py", line 905, in open
#9 5.433 file = builtins.open(filename, mode, buffering)
#9 5.433 FileNotFoundError: [Errno 2] No such file or directory: '/package.json'
#9 5.433 ----------------------------------------
#9 5.433 WARNING: Discarding file:///copyTrading. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#9 5.433 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#9 8.817 WARNING: You are using pip version 21.2.4; however, version 22.2.1 is available.
#9 8.817 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -e .]: exit code: 1
[Project File Tree][1]
[1]: https://i.stack.imgur.com/n2Zqb.png

Related

Unable to install mysqlclient on ubuntu using pip

I have a following problem. I would like to install MySQLdb. I try pip install mysqlclient but I got this error message:
Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydedt20p/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-ydedt20p/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-ydedt20p/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ydedt20p/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ydedt20p/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I am using Python 3.8 on Ubuntu. How can I fix it, please?
Please read and follow the installation instructions for Linux.
For Ubuntu,
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
to install the required libraries before attempting to
pip install mysqlclient

I was trying to deploy a flask app on AWS elastic beanstalk, but am getting this error

2021/03/29 20:18:33.034586 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr: ERROR: Command errored out with exit status 1:
command: /var/app/venv/staging-LQM1lest/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-kktixq46
cwd: /tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/
Complete output (15 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-fywg_th6/mysqlclient_03fe0c7d79f0459190ffa7e229b7666a/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
I used pymysql instead of Flask-MySQLdb and mysqlclient. Worked fine after that.

Exit status 1 error while installing mod_wsgi

I am getting following error while installing mod_wsgi using pip3. I downloaded it once mistakenly before installing Apache, then it threw error for Apache's unavailability and didn't install. Then I installed Apache using command brew install apache2 and then did pip3 install mod_wsgi --no-cache-dir so that it don't take up the cached image, but it didn't work and got following error. Any help is much appreciated. Thanks!
Collecting mod_wsgi
Downloading mod_wsgi-4.7.1.tar.gz (498 kB)
|████████████████████████████████| 498 kB 4.6 MB/s
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0f/3wwtkx4d6m94zpmq0r5rw5c80000gn/T/pip-install-lygp82k1/mod-wsgi_ef198f9a817445a7b3cf53dd590fbdb2/setup.py'"'"'; __file__='"'"'/private/var/folders/0f/3wwtkx4d6m94zpmq0r5rw5c80000gn/T/pip-install-lygp82k1/mod-wsgi_ef198f9a817445a7b3cf53dd590fbdb2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/0f/3wwtkx4d6m94zpmq0r5rw5c80000gn/T/pip-pip-egg-info-2q3u8hgc
cwd: /private/var/folders/0f/3wwtkx4d6m94zpmq0r5rw5c80000gn/T/pip-install-lygp82k1/mod-wsgi_ef198f9a817445a7b3cf53dd590fbdb2/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/0f/3wwtkx4d6m94zpmq0r5rw5c80000gn/T/pip-install-lygp82k1/mod-wsgi_ef198f9a817445a7b3cf53dd590fbdb2/setup.py", line 490, in <module>
target_version = tuple(map(int, target.split('.')))
AttributeError: 'int' object has no attribute 'split'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Error to install MYSQLCLIENT python Linux

Im trying to install the mysqlclient on linux, and keeping reciving this error bellow.
I already tried update the:
sudo apt-get install build-essential
sudo apt-get install libssl-dev
And the error persit:
^C(venv) pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.2.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/felipecid/PycharmProjects/djangoAgenda/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1wsevah8
cwd: /tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/
Complete output (12 lines):
/bin/sh: mysql_config: comando não encontrado
/bin/sh: mariadb_config: comando não encontrado
/bin/sh: mysql_config: comando não encontrado
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-ct6grj28/mysqlclient_e1f80e76b30f4edaaa24bdcfc6a54e18/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The problem is beacause im using the DISTR Linux Mint Version, just sawp for a regular Unbuntu version and works!

Problem in installing PROJ in python environment

Cannot install PROJ
>>pip install git+https://github.com/OSGeo/PROJ.git
Collecting git+https://github.com/OSGeo/PROJ.git
Cloning https://github.com/OSGeo/PROJ.git to c:\users\lenovo\appdata\local\temp\pip-req-build-jwr6msmg
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\lenovo\AppData\Local\Temp\pip-pip-egg-info-w2azftsy'
cwd: C:\Users\lenovo\AppData\Local\Temp\pip-req-build-jwr6msmg\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-jwr6msmg\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried installing it manually using the source file, But it is also giving the following error
>>> pip install proj-7.1.1.tar.gz
Processing e:\wihg\15-09-2020\surfacewave tomography\iris_data\test\proj-7.1.1.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\setup.py'"'"'; __file__='"'"'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\lenovo\AppData\Local\Temp\pip-pip-egg-info-2t2y4p78'
cwd: C:\Users\lenovo\AppData\Local\Temp\pip-req-build-3y5iufx3\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-req-build-3y5iufx3\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
How to solve this error? (Have to install it in Non-conda environment)
PROJ is a C library, not a Python package, so you cannot use pip to install it.
If you just want to work with PROJ from Python, you can use PyPROJ and install it with pip install pyproj. On MacOS, Linux, and Windows this will give you pre-built wheels that already include PROJ.
If you're trying to install it for CartoPy (based on your tags) you'll need to install PROJ separately following their install instructions.

Categories

Resources