[Julia] myBinder build error ("invalid literal for int() with base 10")

I have a Julia package I am developing with some notebooks I would like to let users to play with, and I am using myBinder as online computational environment.

All fine, until I replaced in the [compat] section of Project.toml the entry with Julia with multiple values:

julia = "1.3.1,1.3,1.4,1.5"

Now I receive the following error in myBinder:

Error during build: invalid literal for int() with base 10: '1,1'

Strange enough, I did try to revert using a single Julia entry, but I remain with the same problem.

If this is a bug, where should I report it ?

From the julia Package.toml:

The union of multiple version specifiers can be formed by comma separating individual version specifiers, e.g.

Example = "1.2, 2"

In repo2docker, this is passed to a semver matcher:

                julia_version_str = project_toml["compat"]["julia"]

                # For Project.toml files, install the latest julia version that
                # satisfies the given semver.
                _julia_version = find_semver_match(julia_version_str, self.all_julias)

I assume the semver matcher needs to add support for comma-delimited lists of semver specs.

1 Like

@sgibson91 Thank you. I already tried some commits to revert the julia dependency to a single entry (e.g. Julia=“1.3”) but I am left with the same problem… it is like somewhere it is cached ???

EDIT: Sorry, I was editing the wrong Project.toml (the one in documentation)

I can confirm that changing the julia requirement to a single entry (e.g. julia = "1.4") make mybinder working, so the problem seems the one outlined by @minrk on the find_semver_match function… could support be added to multiple julia versions ?

1 Like

it is like somewhere it is cached ???

Yes, we do do some caching to speed up subsequent builds. I’m not super familiar with the details though unfortunately :-/

If this is a bug, where should I report it ?

The place to report this is the repo2docker repo https://github.com/jupyter/repo2docker and I’d include a link to this thread and mention @minrk’s suggestion that this is likely related to the semver matcher.

1 Like

@sgibson91, @minrk: Thank you both for your support, I have created a new issue: https://github.com/jupyter/repo2docker/issues/907

1 Like

The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit. You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

if val.isdigit():

The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.

Python2.x and Python3.x

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 . With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”.