I'm trying to run a python script with ros2 in my docker container, and everything up to running the Script works, I can even run Gazebo via a launch file, and it works.
The Error ROS gives me is the following:
root#86d8bf3a6eb9:/# ros2 run field_robot robot_spawner.py
Traceback (most recent call last):
File "/opt/ros/foxy/bin/ros2", line 11, in <module>
load_entry_point('ros2cli==0.9.11', 'console_scripts', 'ros2')()
File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
rc = extension.main(parser=parser, args=args)
File "/opt/ros/foxy/lib/python3.8/site-packages/ros2run/command/run.py", line 70, in main
return run_executable(path=path, argv=args.argv, prefix=prefix)
File "/opt/ros/foxy/lib/python3.8/site-packages/ros2run/api/__init__.py", line 61, in run_executable
process = subprocess.Popen(cmd)
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/field_robot/dev_ws/install/field_robot/lib/field_robot/robot_spawner.py'
And yes, I checked, the File actually exists:
root#86d8bf3a6eb9:/# ls -l /field_robot/dev_ws/install/field_robot/lib/field_robot/robot_spawner.py
-rwxr-xr-x 1 root root 1964 Apr 12 14:37 /field_robot/dev_ws/install/field_robot/lib/field_robot/robot_spawner.py
Also, I'm running the Host system on Windows, so it could be that something with windows is fucked up, so if you have an Idea what could be the Problem there, that also might be it
Based on the comments it appears you're running into this issue because of the file type. If they're being edited in Windows first it is likely they are DOS files and not UNIX files. I know this causes issues with ROS1 so I assume it's the case in ROS2 as well. To fix this, you have a couple of options.
Usually the easiest would be to use dos2unix. This isn't installed by default but you can get it via apt install dos2unix assuming your image is Ubuntu. The files can be converted by running dos2unix <filename> inside your container.
Related
As I have stated in the title, I'm having trouble installng Frappe/ERPNext on my Docker. I followed instructions from their official Github repo here.
After opening frappe_docker folder in VSCode, when trying to execute the bench init command I got an error. Below are the full code:
frappe#84badc593d50:/workspace/development$ bench init --skip-redis-config-generation --frappe-branch version-14 frappe-bench
Traceback (most recent call last):
File "/home/frappe/.bench/bench/commands/make.py", line 68, in init
init(
File "/home/frappe/.bench/bench/utils/render.py", line 105, in wrapper_fn
return fn(*args, **kwargs)
File "/home/frappe/.bench/bench/utils/system.py", line 63, in init
bench.setup.dirs()
File "/home/frappe/.bench/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
File "/home/frappe/.bench/bench/bench.py", line 337, in dirs
os.makedirs(self.bench.name, exist_ok=True)
File "/home/frappe/.pyenv/versions/3.10.5/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: 'frappe-bench'
I have had user added to docker group as per instruction and have followed it step by step but I got the error above. I've tried run chmod -R frappe:frappe * at the frappe folder but the error still persist.
My machine is running Pop!_OS 20.04 and Docker Desktop 4.16.1
My bad guys, I found the answer.
All I need to do was run chown frappe:frappe /workspace/development/ and all is well. I can run bench init --skip-redis-config-generation --frappe-branch version-14 frappe-bench without a problem after that.
I try to run a docker container with a tkinter gui app in python and x11 forwarding for a machine learning application. When I run the image with
sudo docker run --runtime=nvidia --gpus='all' --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" -i ganspace
I got the following display connection error, but the app seams to run
Downloading https://drive.google.com/uc?export=download&id=1FJRwzAkV-XWbxgTwxEmEACvuqF5DsBiV
Not cached
[19.07 19:59] Computing stylegan2-ffhq_style_ipca_c80_n1000000_w.npz
Reusing InstrumentedModel instance
Using W latent space
Feature shape: torch.Size([1, 512])
B=10000, N=1000000, dims=512, N/dims=1953.1
Sampling latents: 100%|██████████| 101/101 [00:08<00:00, 11.80it/s]
Fitting batches (NB=10000): 100%|##########| 100/100 [00:19<00:00, 5.11it/s]Authorization required, but no authorization protocol specified
Authorization required, but no authorization protocol specified
Total time: 0:00:28.239383
Loaded components for ffhq from /ganspace/cache/components/stylegan2-ffhq_style_ipca_c80_n1000000_w.npz
Traceback (most recent call last):
File "interactive.py", line 645, in <module>
setup_ui()
File "interactive.py", line 214, in setup_ui
root = tk.Tk()
File "/opt/conda/envs/ganspace/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":1"
If I run the image in the following way with
sudo docker run -u=$(id -u $USER):$(id -g $USER) -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --rm -it --runtime=nvidia --gpus='all' ganspace
the display connection is working (I tested it with another tkinter image), but I got the following permission error due to the user I think
Traceback (most recent call last):
File "interactive.py", line 644, in <module>
setup_model()
File "interactive.py", line 143, in setup_model
inst = get_instrumented_model(model_name, class_name, layer_name, torch.device('cuda'), use_w=args.use_w)
File "/opt/conda/envs/ganspace/lib/python3.7/functools.py", line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/ganspace/models/wrappers.py", line 695, in get_instrumented_model
model = get_model(name, output_class, device, **kwargs)
File "/opt/conda/envs/ganspace/lib/python3.7/functools.py", line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/ganspace/models/wrappers.py", line 680, in get_model
model = StyleGAN2(device, class_name=output_class)
File "/ganspace/models/wrappers.py", line 125, in __init__
self.load_model()
File "/ganspace/models/wrappers.py", line 160, in load_model
os.makedirs(checkpoint.parent, exist_ok=True)
File "/opt/conda/envs/ganspace/lib/python3.7/os.py", line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/opt/conda/envs/ganspace/lib/python3.7/os.py", line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/ganspace/models/checkpoints'
ERROR conda.cli.main_run:execute(49): `conda run python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w -n=1_000_000 -b=10_000` failed. (See above for error)
Any ideas how to fix this or another solution to have the right permission and get the connection to the display correctly? thanks in advance!
It says permission issue because current user is not having the permission for
/ganspace/models/checkpoints directory
Add the below line in your Dockerfile to give permission for that path
RUN chmod -R 777 /ganspace/models/checkpoints
Note: 777 gives full permission. change it accordingly based on what all permission you require. check permissions in linux
I just started with yandex-tank, and has failed at first step.
I am trying to execute command
docker run direvius/yandex-tank
And got an error:
Traceback (most recent call last):
File "/usr/local/bin/yandex-tank", line 11, in <module>
load_entry_point('yandextank==1.12.1', 'console_scripts', 'yandex-tank')()
File "/usr/local/lib/python2.7/dist-packages/yandextank/core/cli.py", line 130, in main
log_handlers=handlers
File "/usr/local/lib/python2.7/dist-packages/yandextank/core/consoleworker.py", line 327, in __init__
self.config_list = self._combine_configs(configs, cli_options, cfg_patches, cli_args, no_local)
File "/usr/local/lib/python2.7/dist-packages/yandextank/core/consoleworker.py", line 354, in _combine_configs
parse_and_check_patches(cfg_patches) + \
File "/usr/local/lib/python2.7/dist-packages/yandextank/core/consoleworker.py", line 77, in load_cfg
with open(cfg_filename) as f:
IOError: [Errno 2] No such file or directory: 'load.yaml'
My enviroment is Windows. And I am don't understand how can I add load.yaml without running container? And I can't run container without load.yaml
yandex-tank uses load.yaml in the directory as the default config file. However, the image of the container doesn't have such file https://github.com/yandex/yandex-tank/blob/develop/docker/Dockerfile.
Given that its entrypoint launches yandex-tank right away, I guess you will need to create a new image, using as base FROM direvius/yandex-tank, and COPY your configuration to this image, either as the default value load.yaml, or with a different name / path (in this case, you must use -c option when running the image).
You cannot run direvius/yandex-tank and then docker cp load.yaml <container_path>, because since the very moment you run the container, it crashes with the error you got.
I keep getting this error when trying to pip install ipython on my Windows. pip worked for pandas and other libs.
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\Me\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\site-packages\\jedi\\third_party\\typeshed\\third_party\\2and3\\requests\\packages\\urllib3\\packages\\ssl_match_hostname\\_implementation.pyi'
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\commands\install.py", line 407, in run
use_user_site=options.use_user_site,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\req\__init__.py", line 58, in install_given_reqs
**kwargs
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\req\req_install.py", line 928, in install
use_user_site=use_user_site, pycompile=pycompile,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\req\req_install.py", line 461, in move_wheel_files
warn_script_location=warn_script_location,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\wheel.py", line 432, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\site-packages\pip\_internal\wheel.py", line 410, in clobber
shutil.copyfile(srcfile, destfile)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\My User\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python37\\site-packages\\jedi\\third_party\\typeshed\\third_party\\2and3\\requests\\packages\\urllib3\\packages\\ssl_match_hostname\\_implementation.pyi'```
I had similar issue. I changed the registry key "Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled" to 1.
I had the same problem. For me it was, that the file path was too long. Rename things (for example the PythonSoftwareFoundation.Python.3.7_3.7.1473.0_x64__qbz5n2kfra8p0 stuff) to shorten the path.
The Windows Python installer allows you to change the maximum path length at install or upgrade and this will fix the problem. You can also lookup change maximum path length Win 10 to find out how to change the registry.
I'm on Win10 x64 following the instructions at https://docs.bigchaindb.com/projects/server/en/latest/appendices/run-with-docker.html
Because I'm running in windows (and don't have $HOME), here's the actual commands I'm running:
docker run --rm -v "C:/bigchaindb_docker:/data" -ti bigchaindb/bigchaindb -y configure rethinkdb
docker run -v "C:/bigchaindb_docker:/data" -d --name bigchaindb -p "58080:8080" -p "59984:9984" bigchaindb/bigchaindb start
The first command seems to execute just fine. I see a .bigchaindb file in my C:/bigchaindb_docker folder. The second command will start a container but around 6 seconds later the container exits with code 1. I ran docker start <container> && docker attach <container> and was able to get this dump:
INFO:bigchaindb.commands.bigchain:BigchainDB Version 0.10.0.dev
INFO:bigchaindb.config_utils:Configuration loaded from `/data/.bigchaindb`
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/rethinkdb/net.py", line 271, in __init__
self._socket = socket.create_connection((self.host, self.port), timeout)
File "/usr/lib/python3.5/socket.py", line 711, in create_connection
raise err
File "/usr/lib/python3.5/socket.py", line 702, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/bigchaindb", line 11, in <module>
load_entry_point('BigchainDB', 'console_scripts', 'bigchaindb')()
File "/usr/src/app/bigchaindb/commands/bigchain.py", line 401, in main
utils.start(create_parser(), sys.argv[1:], globals())
File "/usr/src/app/bigchaindb/commands/utils.py", line 96, in start
return func(args)
File "/usr/src/app/bigchaindb/commands/bigchain.py", line 201, in run_start
_run_init()
File "/usr/src/app/bigchaindb/commands/bigchain.py", line 142, in _run_init
schema.init_database(connection=b.connection)
File "/usr/src/app/bigchaindb/backend/schema.py", line 99, in init_database
create_database(connection, dbname)
File "/usr/lib/python3.5/functools.py", line 743, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/src/app/bigchaindb/backend/rethinkdb/schema.py", line 17, in create_database
if connection.run(r.db_list().contains(dbname)):
File "/usr/src/app/bigchaindb/backend/rethinkdb/connection.py", line 49, in run
self._connect()
File "/usr/src/app/bigchaindb/backend/rethinkdb/connection.py", line 73, in _connect
self.conn = r.connect(host=self.host, port=self.port, db=self.dbname)
File "/usr/local/lib/python3.5/dist-packages/rethinkdb/net.py", line 661, in connect
return conn.reconnect(timeout=timeout)
File "/usr/local/lib/python3.5/dist-packages/rethinkdb/net.py", line 572, in reconnect
return self._instance.connect(timeout)
File "/usr/local/lib/python3.5/dist-packages/rethinkdb/net.py", line 430, in connect
self._socket = SocketWrapper(self, timeout)
File "/usr/local/lib/python3.5/dist-packages/rethinkdb/net.py", line 337, in __init__
(self.host, self.port, str(ex)))
rethinkdb.errors.ReqlDriverError: Could not connect to localhost:28015. Error: [Errno 111] Connection refused
I am looking into using BigChainDB and I don't know much about it. I'd guess that it's trying to connect to rethinkdb and it's not running. I don't know where to begin to fix that, I've never used rethinkdb either. Has anybody run into this problem before?
From the first line of the logs you provided it looks like you are running the master branch:
INFO:bigchaindb.commands.bigchain:BigchainDB Version 0.10.0.dev
It used to be that the latest tag of a BigchainDB (docker) image would point to the latest master branch. This was changed recently such that it now points to the latest release, matching what is on the Python Package Index (PyPI).
So if you pull the image again it should update to the latest release which at the time of writing is 0.9.5. That is:
docker pull bigchaindb/bigchaindb
or equivalently:
docker pull bigchaindb/bigchaindb:latest
or explicitly pulling the tag 0.9.5:
docker pull bigchaindb/bigchaindb:0.9.5
If you use version 0.9.5, and try the two commands you posted it should work.
If you wish to use the latest master branch, then you will need to run RethinkDB since it is no longer embedded in the Docker image. Detailed instructions can be found in the master version of the BigchainDB documentation under the Run the backend database section.