Page MenuHomePhabricator

`Class 'Wikibase\DataModel\Entity\ItemId' not found` error when trying to install WikibaseLexeme
Closed, ResolvedPublic

Description

I am trying to set up development environment for WikibaseLexeme.

I am following instructions at addshore/mediawiki-docker-dev and wikimedia/mediawiki-extensions-WikibaseLexeme.

Everything works fine until I run this from WikibaseLexeme/README.md:81:

1~/Documents/github/addshore/mediawiki-docker-dev$ docker-compose exec "web" php /var/www/mediawiki/maintenance/update.php --wiki default --quick
2[26142080ebaf7fde12c6233c] [no req] Error from line 35 of /var/www/mediawiki/extensions/Wikibase/lib/WikibaseLib.entitytypes.php: Class 'Wikibase\DataModel\Entity\ItemId' not found
3Backtrace:
4#0 /var/www/mediawiki/extensions/Wikibase/repo/includes/WikibaseRepo.php(567): require()
5#1 /var/www/mediawiki/extensions/Wikibase/repo/includes/WikibaseRepo.php(313): Wikibase\Repo\WikibaseRepo::getDefaultEntityTypes()
6#2 /var/www/mediawiki/extensions/Wikibase/repo/includes/WikibaseRepo.php(371): Wikibase\Repo\WikibaseRepo::newInstance()
7#3 /var/www/mediawiki/extensions/Wikibase/repo/RepoHooks.php(98): Wikibase\Repo\WikibaseRepo::getDefaultInstance()
8#4 /var/www/mediawiki/includes/Hooks.php(174): Wikibase\RepoHooks::onSetupAfterCache()
9#5 /var/www/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
10#6 /var/www/mediawiki/includes/Setup.php(791): Hooks::run(string)
11#7 /var/www/mediawiki/maintenance/doMaintenance.php(81): require_once(string)
12#8 /var/www/mediawiki/maintenance/update.php(245): require_once(string)
13#9 {main}

Event Timeline

Restricted Application added a project: Wikidata. · View Herald TranscriptJun 21 2018, 2:05 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@Addshore can you help? Do you need more information?

Just looking at the error message it would seem composer didn't pull in dependencies. But looking at README.md running composer is mentioned to be done before running update.php (which makes sense), so I don't quite get why it could fail.

Maybe @Tarrow has an idea what could be going wrong here?

I don't have much experience with Docker, so in attempt to start clean, I have deleted addshore/mediawiki-docker-dev, mediawiki/core, Wikibase and WikibaseLexeme repositories and cloned them again. I get the same error message. I think I remember the instructions working fine before on this machine and at another machine. I am not sure what changed in the meantime.

How do I make sure that I have removed all Docker stuff and start fresh? That might be easier than trying to debug what went wrong?

I am not a docker ninja, but when in a need to remove ALL docker stuff I use: docker system prune.
Note that it is going to remove all stopped containers, not only mediawiki ones (if you have others running).
Also keep in mind the note about volumes from the docs (i.e. if you want to remove all all then also run: docker system prune --volumes)

Thanks, I did run docker system prune and docker system prune --volumes. I still get the same error message. 😢

Have you run composer update / install on both mediawiki and Wikibase and WikibaseLexeme?
Or are you using the composer merge-plugin to install all extension deps under the core vendor dir?
Or are you using the mediawiki-vendor git repo?

I am following instructions from addshore/mediawiki-docker-dev and wikimedia/mediawiki-extensions-WikibaseLexeme. I am at docker-compose exec "web" php /var/www/mediawiki/maintenance/update.php --wiki default --quick step of WikibaseLexeme's readme file. I can provide the entire terminal output if that would help.

@zeljkofilipin Can you paste a copy of the composer.lock file in your root mediawiki dir?

Okay, so https://packagist.org/packages/wikibase/data-model isn't listed there at all.
It doesn't look like you have done the "Install the dependencies with composer:" step in the WikibaseLexeme readme.

What is in your composer.local.json in the root mediawiki dir?

It doesn't look like you have done the "Install the dependencies with composer:" step in the WikibaseLexeme readme.

But I did:

~/Documents/gerrit/mediawiki/core$ docker run -it --rm --user $(id -u):$(id -g) -v ~/.composer:/composer -v $(pwd):/app docker.io/composer install
> ComposerHookHandler::onPreInstall
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> ComposerVendorHtaccessCreator::onEvent

What is in your composer.local.json in the root mediawiki dir?

{
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/Wikibase/composer.json"
			]
		}
	}
}

Hmmmm

Nothing to install or update

but wikibase/data-model still isn't in your composer.lock?

Could be some sort of bug with the composer merge plugin?

All I can think of suggestion is remove you vendor dir and the composer.lock file and try again.

but wikibase/data-model still isn't in your composer.lock?

No.

Could be some sort of bug with the composer merge plugin?

🤷‍♂️

All I can think of suggestion is remove you vendor dir and the composer.lock file and try again.

Deleted vendor, composer.lock and composer.local.json.

~/Documents/gerrit/mediawiki/core$ docker run -it --rm --user $(id -u):$(id -g) -v ~/.composer:/composer -v $(pwd):/app docker.io/composer install
> ComposerHookHandler::onPreUpdate
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 82 installs, 0 updates, 0 removals
  - Installing wikimedia/composer-merge-plugin (v1.4.1): Downloading (100%)  
...
Writing lock file
Generating optimized autoload files
> ComposerHookHandler::onPreUpdate
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
Generating optimized autoload files
> ComposerVendorHtaccessCreator::onEvent
> ComposerVendorHtaccessCreator::onEvent

Created composer.local.json.

~/Documents/gerrit/mediawiki/core$ docker run -it --rm --user $(id -u):$(id -g) -v ~/.composer:/composer -v $(pwd):/app docker.io/composer install
> ComposerHookHandler::onPreInstall
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 1 update, 0 removals
  - Updating jetbrains/phpstorm-stubs dev-master (1b99060 => 75aeabe):  Checking out 75aeabe30f
Generating optimized autoload files
> ComposerVendorHtaccessCreator::onEvent

It did not install anything, just one update. 🤔

Change 442283 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[mediawiki/extensions/WikibaseLexeme@master] Add missing curly bracket to readme file

https://gerrit.wikimedia.org/r/442283

Change 442283 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Add missing curly bracket to readme file

https://gerrit.wikimedia.org/r/442283

Does it work with the fix in the README from the patch?

My composer.local.json was always good, I have noticed that the readme was wrong in a desperate attempt to follow the instructions blindly. 🕶

So, nobody else can reproduce the problem?

Maybe there is something wrong with my machine. Do I need to have a specific version of composer or composer merge plugin?

How do I make sure I have removed everything and start from scratch? I have tried deleting addshore/mediawiki-docker-dev, core, extensions and skins. I have run docker system prune, docker system prune --volumes and docker system prune --all.

@Tarrow as you wrote the readme and I assume use the composer merge plugin any chance you could take a look at this?

I will certainly take a look but I don't actually use the composer merge plugin.

I altered the instructions to use it after hearing from someone in the office that they've had a big discussion about it and it's the "right" way to do it. Perhaps it's actually clunkier..

Change 443044 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/WikibaseLexeme@master] Include more details about composer running in README.md

https://gerrit.wikimedia.org/r/443044

I'm happy to report I can repeat the problem; I guess the issue is something about the merge plugin not running until the first run after it is installed.

The solution seems to be to run composer install twice.

I'll add this to the readme.

• Vvjjkkii renamed this task from `Class 'Wikibase\DataModel\Entity\ItemId' not found` error when trying to install WikibaseLexeme to ziaaaaaaaa.Jul 1 2018, 1:02 AM
• Vvjjkkii updated the task description. (Show Details)
• Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from ziaaaaaaaa to `Class 'Wikibase\DataModel\Entity\ItemId' not found` error when trying to install WikibaseLexeme.Jul 2 2018, 11:24 AM
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

Change 443044 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Include more details about composer running in README.md

https://gerrit.wikimedia.org/r/443044

zeljkofilipin closed this task as Resolved.Jul 3 2018, 10:41 AM
zeljkofilipin claimed this task.