Difficulty installing a GitHub package

I am a novice drone pilot/programmer and could use some help. I am trying use a repository from GitHub called “pyulog” that will allow me to read and edit data from a simulated flight in a .csv file.

I am trying to convert a .ulg file that I got from a jMavSim simulation to .csv using pyulog, but I am unable use the ulog2csv command, along with any other command in the pyulog repository. I have installed python and downloaded the pyulog zip files from GitHub, and I am pretty sure I have installed it correctly using the following line entered into my terminal (Windows 11):

py -m pip install pyulog

I have tried extracting the file from github to both C:\Users[my username] and to downloads, as well as changing the directory in the terminal. But whenever I attempt to use either ulog_info or ulog2csv the error says that the file “doesn’t exist” or that “main” cannot be found. It doesn’t seem like anyone else has had a similar issue on these forums or on the drone forums, so I believe that the problem lies with my inexperience with GitHub and programming in general. I would appreciate any advice or instruction that y’all would be willing to give. Thank you.

The command py -m pip install pyulog does install the package neither from GitHub nor from a downloaded file but from the PyPI repository: pyulog · PyPI Anyway the repository currently contains probably the latest tagged release from GitHub.

The list console_scipts in setup.py defines names of executables which are added to a certain directory during installation. The directory should normally be accessible from your PATH - environment variable defining list of directories with executables. According to your description, the directory is not in your PATH. If so the executables cannot be found if you try to execute them just by their name.

For installing packages I normally use venv (virtual environment). It is a built-in tool which creates a directory in which all packages will be installed. This way you have a great control over where everything will go including the executables.

The procedure below is for Unix-like systems (Windows differ somewhat):

python3 -m venv pyulog_venv      # create the venv - The last argument is the directory to be created. The directory will contain everything installed when the venv is active.
source pyulog_venv/bin/activate  # activate the venv (adds its bin/ directory to my PATH)
pip install -U pip setuptools    # update the basic pre-installed packages
pip install pyulog               # install the package

The installation creates the executables in the directory pyulog_venv/bin/ which was temporarily added to my PATH by sourcing the activate script.

1 Like

By Owen Dunston via Discussions on Python.org at 06Jun2022 22:06:

I am a novice drone pilot/programmer and could use some help. I am
trying use a repository from GitHub called “pyulog” that will allow me
to read and edit data from a simulated flight in a .csv file.

I am trying to convert a .ulg file that I got from a jMavSim simulation to .csv using pyulog, but I am unable use the ulog2csv command, along with any other command in the pyulog repository. I have installed python and downloaded the pyulog zip files from GitHub, and I am pretty sure I have installed it correctly using the following line entered into my terminal (Windows 11):

py -m pip install pyulog

That should work. I’ve never used pyulog, but running the above command
here installed ulog2csv and a bunch of other ulog* commands.

Note that these commands land in the bin directory of the environment
in which the pyulog package was installed.

When I ran this as a plain “user” pip install I got this warning:

WARNING: The scripts ulog2csv, ulog2kml, ulog_extract_gps_dump, ulog_info, ulog_messages and ulog_params are installed in '/Users/cameron/Library/Python/3.10/bin' which is not on PATH.

I’m on a Mac, so the path will be different on your system. But basicly,
it should have installed the commands in your personal python area and
it looks like that area’s bin subdirectory is not in your %path
variable, so the commands, though installed, are not found.

I’m not a windows person, so I can’t provide the windows specifics to
fix this, but I expect it to amount to adding something to %path.

Have a look here:
https://docs.python.org/3/using/windows.html#configuring-python

There are two specific variables of interest: %PATH% which is where
the command prompt searches for command names, and %PYTHONPATH% which
is where Python itself search for modules/packages like pyulog.

You should not need to worry about %PYTHONPATH%; by using py -m pip install pyulog the module should already be installed in the right
place. But you may need to adjust %PATH% to find the command line
tools that came with it.

Cheers,
Cameron Simpson cs@cskk.id.au

If you have successfully installed the pyulog package using pip, you don’t also have to install from Github.

Owen says:

“whenever I attempt to use either ulog_info or ulog2csv the error says that the file “doesn’t exist” or that “main” cannot be found.”

Please tell us exactly what “attempt to use” means. If there an icon on your desktop that you double-click, or a Start menu item? Or do you type a command at command.com or Powershell or cmd.exe? Or something else?

If you are typing a command, tell us exactly what command you are typing, the directory you are in, and the exact error message (if possible). Preferably copy and paste the command rather than retype it or taking a screen shot.

1 Like

It worked! I created the virtual environment using a method similar to what you posted except adjusted for Windows 11. Thank you :medal_sports: :smiley: