Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving models to relative path fails #131

Closed
Ax3man opened this issue Dec 11, 2024 · 2 comments
Closed

Saving models to relative path fails #131

Ax3man opened this issue Dec 11, 2024 · 2 comments
Assignees

Comments

@Ax3man
Copy link

Ax3man commented Dec 11, 2024

When trying to save a UMAP model:

save_uwot(orange_UMAP, 'my_folder/orange_UMAP')

I get this error:

Error in file(tarfile, "wb") : cannot open the connection
In addition: Warning messages:
1: In normalizePath(dirname(filename)) :
  path[1]="my_folder": No such file or directory
2: In file(tarfile, "wb") :
  cannot open file 'my_folder/orange_UMAP': No such file or directory

Changing to:

save_uwot(orange_umap, uwot:::abspath('my_folder/orange_UMAP'))

resolves the issue, suggesting that it is an issue with relative paths.

I think the issue stems from:

uwot/R/uwot.R

Lines 3960 to 3961 in fd5f337

setwd(mod_dir)
tmp_model_file <- abspath(file)

The absolute file path is computed after the change of working directory. Swapping these two lines fixed the issue for me.

@jlmelville
Copy link
Owner

Thank you for the report @Ax3man. And also for specifying the fix. for which I have made you a contributor in the DESCRIPTION. This should be fixed in master. I don't know when I will next attempt a new submission to CRAN though.

@Ax3man
Copy link
Author

Ax3man commented Dec 17, 2024

Much appreciated!

@Ax3man Ax3man closed this as completed Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants