Sublime Forum

Pathlib not found in purchased version

#1

I own sublime text but on my second machine I have yet to add the license key.

I have a plugin that I have been working on. On the second machine the plugin is working fine. On my primary machine with what I believe is an up to date registered version of sublime text it is not able to find pathlib when loading my plugin:

ImportError: No module named ‘pathlib’

I am confused as to why my secondary machine has pathlib while my primary machine does not since I have not done any mucking about with pip on either machine.

Any help would be greatly appreciated.

0 Likes

#2

pathlib was added in Python 3.4, but Sublime 3.2.2 uses Python 3.3 for the plugin system (though this is changing to a newer Python in the next release).

So generally speaking, pathlib shouldn’t be available at all; however it is available in a package control dependency (the list of those can be found here).

If the plugin works on one copy and not the other, then I suspect the reason is that one of the copies has a package installed that requires this dependency. Dependencies are available to all packages and not just the one that requested it. If there’s a folder named pathlib in the Packages folder, this is the case.

The best fix is to declare that your package also requires the dependency to ensure that it gets installed, but in a pinch syncing your list of installed packages between machines (or determining which package is depending on it and installing that) will get it working in the meantime.

PackageDev is an example of a package that requires this dependency, so installing that should fix it as well (plus it’s just an awesome package in general).

2 Likes

#3

Thank you for the amazing response!
This is extremely helpful!

0 Likes