Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"Can't find package xxx" - even though it's installed in tcl_pkgPath

174 views
Skip to first unread message

alex.rast...@gmail.com

unread,
Sep 30, 2012, 4:29:33 PM9/30/12
to
Probably the subject line indicates most of the issue. If I run a script containing a

package require xxx

tcl is complaining that it can't find the package, even though I've confirmed that it's definitely in a subdirectory in the tcl_pkgPath. No idea why this is happening, although it seems to me to be likely to be something very, very basic.

This is running tcl 8.5 in Fedora 17.

tcl_pkgPath variable is /usr/lib/tcl8.5 /usr/share/tcl8.5 /usr/lib/tk8.5 /usr/share/tk8.5.

I don't know what other information you may need; please let me know and I'll attempt to provide it.

Harald Oehlmann

unread,
Sep 30, 2012, 5:02:02 PM9/30/12
to
please check the output of "package names".
Remember, that package names are case sensitive.
The package file "pkgIndex.tcl" must be in the package folder or in a
direct subfolder of it.
Look to this file. You will find the package name in there.

Or it is a tcl module. Than, the module path is relevant and the
package name is equal to the file name up to the first "_".
msgcat_1.4.9.tcl -> package "msgcat".

Hope this helps,
Harald

Don Porter

unread,
Sep 30, 2012, 5:11:08 PM9/30/12
to
On 09/30/2012 04:29 PM, alex.rast...@gmail.com wrote:
> tcl is complaining that it can't find the package, even though
> I've confirmed that it's definitely in a subdirectory in the tcl_pkgPath.

What are the contents of the installed pkgIndex.tcl file?

--
| Don Porter Applied and Computational Mathematics Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|

alex.rast...@gmail.com

unread,
Oct 1, 2012, 11:24:24 AM10/1/12
to
On Sunday, 30 September 2012 22:11:12 UTC+1, Don Porter wrote:
> On 09/30/2012 04:29 PM, alex.rast...@gmail.com wrote:
>
> > tcl is complaining that it can't find the package, even though
>
> > I've confirmed that it's definitely in a subdirectory in the tcl_pkgPath.
>
>
>
> What are the contents of the installed pkgIndex.tcl file?
>
>

package ifneeded ylex 0.3 [list source [file join $dir ylex.tcl]]
package ifneeded yeti 0.3 [list source [file join $dir yeti.tcl]]

Don Porter

unread,
Oct 1, 2012, 11:42:33 AM10/1/12
to

>>> tcl is complaining that it can't find the package, even though
>>> I've confirmed that it's definitely in a subdirectory in the tcl_pkgPath.

>> What are the contents of the installed pkgIndex.tcl file?

> package ifneeded ylex 0.3 [list source [file join $dir ylex.tcl]]
> package ifneeded yeti 0.3 [list source [file join $dir yeti.tcl]]

After the failed [package require ylex], does the list returned by
[package names] include the names "ylex" and "yeti" ? I presume not.

It is nearly certain that Tcl is not searching where you think it is,
or should be.

This can have a number of confusions at its root. Most useful would be
a transcript of an interactive session where you demonstrate the failure
alongside the results of things like [set ::auto_path] and
[package present Tcl] to ascertain that you really are working with
what you think you are.

--

alex.rast...@gmail.com

unread,
Oct 1, 2012, 12:12:53 PM10/1/12
to
Thanks all - the hint allowed me to track down the source of the problem. The package ifneeded commands were specifying a different version number than the version provided in the packages themselves. I found the same problem in various of the other packages in other subdirectories, so this appears to have been the root cause. (I might write some little verification/correction script to update version numbers where appropriate)

Don Porter

unread,
Oct 1, 2012, 12:16:32 PM10/1/12
to
On 10/01/2012 12:12 PM, alex.rast...@gmail.com wrote:

>The package ifneeded commands were specifying a different version
> number than the version provided in the packages themselves.

You must be working with rather old releases of Tcl then. Any Tcl
release within the last few years is written to detect that scenario
and present a better error message than "Can't find" your package.

--

4691...@qq.com

unread,
Aug 6, 2018, 8:39:26 AM8/6/18
to
you need to use the command "pkg_mkIndex -direct",then you will get the file pkgIndex.tcl try your code again it will be ok

Rich

unread,
Aug 6, 2018, 11:29:28 AM8/6/18
to
Wow, replying to a message that is almost *six years* old. Google
groups strikes again.
0 new messages