# File 'topicsquiz.launch.py' was not found in the share directory of package 'topics\_quiz' which is at '/home/user/ros2\_ws/src/install/topics\_quiz/share/topics\_quiz'

**URL:** <https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422>\
**Category:** ROS2 in 5 Days C++\
**Tags:** error\
**Created:** [January 16, 2024, 12:35pm UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422 "2024-01-16T12:35:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charbel\_Beaini](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/c/258eb7/32.png) [@Charbel\_Beaini](https://get-help.theconstruct.ai/u/Charbel_Beaini)\
**Post date:** [January 16, 2024, 12:35pm UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/1 "2024-01-16T12:35:39Z")

</div>

Hello,  
This error is coming up for some reason and I can’t figure out why.

# This is my Cmake code:

cmake\_minimum\_required(VERSION 3.8)  
project(topics\_quiz)

if(CMAKE\_COMPILER\_IS\_GNUCXX OR CMAKE\_CXX\_COMPILER\_ID MATCHES “Clang”)  
add\_compile\_options(-Wall -Wextra -Wpedantic)  
endif()

#find dependencies  
find\_package(ament\_cmake REQUIRED)  
find\_package(rclcpp REQUIRED)  
find\_package(std\_msgs REQUIRED)  
find\_package(sensor\_msgs REQUIRED)  
find\_package(geometry\_msgs REQUIRED)

if(BUILD\_TESTING)  
find\_package(ament\_lint\_auto REQUIRED)  
#the following line skips the linter which checks for copyrights  
#comment the line when a copyright and license is added to all source files  
set(ament\_cmake\_copyright\_FOUND TRUE)  
#the following line skips cpplint (only works in a git repo)  
#comment the line when this package is in a git repo and when  
#a copyright and license is added to all source files  
set(ament\_cmake\_cpplint\_FOUND TRUE)  
ament\_lint\_auto\_find\_test\_dependencies()  
endif()

add\_executable(sub\_laser\_node src/laser\_sub.cpp)  
ament\_target\_dependencies(sub\_laser\_node rclcpp std\_msgs sensor\_msgs geometry\_msgs)

install(TARGETS  
sub\_laser\_node  
DESTINATION lib/${PROJECT\_NAME}  
)

#Install launch files.  
install(DIRECTORY  
launch  
DESTINATION share/${PROJECT\_NAME}/  
)

#ament\_target\_dependencies(sub\_odom\_node rclcpp std\_msgs)

ament\_package()

# This is my launch file:

from launch import LaunchDescription  
from launch\_ros.actions import Node

def generate\_launch\_description():  
return LaunchDescription([  
Node(  
package=‘topics\_quiz’,  
executable=‘sub\_laser\_node’,  
output=‘screen’),  
])

# This is my input to the terminal:

ros2 launch topics\_quiz topicsquiz.launch.py

Thanks!

---

<div class="post-metadata">

**Author:** ![Mikalojus](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/mikalojus/32/7861_2.png) [@Mikalojus](https://get-help.theconstruct.ai/u/Mikalojus)\
**Post date:** [January 16, 2024, 12:43pm UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/2 "2024-01-16T12:43:26Z")

</div>

I don’t know how relevant, since i am doing ROS basics in pythons, but had the same issue.  
Have you double checked where that topicsquiz.launch.py is inside the launch directory which is inside the topics\_quiz package?  
In my case this launch file and folder were inside /ros2\_ws directory not inside the package.

---

<div class="post-metadata">

**Author:** ![Charbel\_Beaini](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/c/258eb7/32.png) [@Charbel\_Beaini](https://get-help.theconstruct.ai/u/Charbel_Beaini)\
**Post date:** [January 16, 2024, 12:46pm UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/3 "2024-01-16T12:46:59Z")

</div>

![Capture](https://get-help.robotigniteacademy.com/uploads/default/original/2X/8/8aab2e3583e119c78fa83993b98aced9a929a7d7.jpeg)

This is the location of my launch file which is inside a file called launch and inside my package. So if I understood your point, I don’t think that’s the issue

---

<div class="post-metadata">

**Author:** ![Mikalojus](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/mikalojus/32/7861_2.png) [@Mikalojus](https://get-help.theconstruct.ai/u/Mikalojus)\
**Post date:** [January 16, 2024, 1:28pm UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/4 "2024-01-16T13:28:46Z")

</div>

I see, you understood me correctly.  
Don’t know then, maybe try build and source again, maybe again after restarting the website

---

<div class="post-metadata">

**Author:** ![bayodesegun](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/bayodesegun/32/10684_2.png) [@bayodesegun](https://get-help.theconstruct.ai/u/bayodesegun)\
**Post date:** [January 17, 2024, 10:17am UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/5 "2024-01-17T10:17:46Z")

</div>

> [@Charbel\_Beaini](#):
>
> topicsquiz.launch.py

I see two problems here:

- The name of the quiz launch file should be `topics_quiz.launch.py`. Rename it, or you will fail the quiz because of wrong name.
- It seems you are yet to set up the launch file properly. Go over the examples explain the setup part.

---

<div class="post-metadata">

**Author:** ![Charbel\_Beaini](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/c/258eb7/32.png) [@Charbel\_Beaini](https://get-help.theconstruct.ai/u/Charbel_Beaini)\
**Post date:** [January 18, 2024, 10:58am UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/6 "2024-01-18T10:58:16Z")

</div>

I discovered my mistake! Indeed it was in the sourcing I was doing it for the install file outside of the src file which is why my launch file couldn’t be found.

Fixed my problem thank you

---

<div class="post-metadata">

**Author:** ![system](https://get-help.theconstruct.ai/uploads/default/original/2X/9/9d3ce8305cc0d0d9b6e07d15767a6f245c526f1b.jpeg) [@system](https://get-help.theconstruct.ai/u/system)\
**Post date:** [January 23, 2024, 10:59am UTC](https://get-help.theconstruct.ai/t/file-topicsquiz-launch-py-was-not-found-in-the-share-directory-of-package-topics-quiz-which-is-at-home-user-ros2-ws-src-install-topics-quiz-share-topics-quiz/28422/7 "2024-01-23T10:59:06Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
