activitywatch icon indicating copy to clipboard operation
activitywatch copied to clipboard

Issue with Building ActivityWatch: ModuleNotFoundError: No module named 'aw_server'

Open kcs-santoshahire opened this issue 1 year ago • 1 comments

Discussed in https://github.com/orgs/ActivityWatch/discussions/1039

Originally posted by kcs-santoshahire April 4, 2024 I encountered an issue while trying to build ActivityWatch following the steps outlined in the documentation (https://docs.activitywatch.net/). After cloning the project repository and attempting to build it using the make build command, I received the following error:

python -c "import aw_server; print(aw_server.__version__)" Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'aw_server' make: *** [build] Error 1

Description: It seems that the build process is failing due to a missing module named 'aw_server'. I followed the installation instructions provided in the documentation, but I'm unable to proceed with the build due to this error.

Steps to Reproduce:

Clone the ActivityWatch repository from GitHub. Follow the installation instructions provided in the documentation. Attempt to build the project using the make build command. Expected Behavior: The build process should complete successfully without any errors, allowing me to proceed with running ActivityWatch.

Actual Behavior: The build process fails with a ModuleNotFoundError for 'aw_server', preventing me from completing the build and running the application.

Additional Information:

Operating System: Windows 11 Python Version: 3.8.0

Any other relevant details about your environment or setup. I would appreciate any assistance in resolving this issue so that I can successfully build and use ActivityWatch. Thank you for your attention to this matter.

Best regards, Santosh Ahire

kcs-santoshahire avatar Apr 05 '24 07:04 kcs-santoshahire

Hi there! As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct. Thanks a bunch for opening your first issue! 🙏

github-actions[bot] avatar Apr 05 '24 07:04 github-actions[bot]

Facing the same issue on linux. Any update on this issue?

MohammadAliAfsahi avatar May 10 '24 15:05 MohammadAliAfsahi

The error most frequently occurs if you have not activated a Python virtual environment before starting the build.

ErikBjare avatar May 10 '24 16:05 ErikBjare

The error most frequently occurs if you have not activated a Python virtual environment before starting the build.

I have activated the Python virtual environment

MohammadAliAfsahi avatar May 10 '24 16:05 MohammadAliAfsahi

Then you need to figure out why it can't find aw_server in the Python environment (what the check is for), after it has just been installed.

ErikBjare avatar May 10 '24 16:05 ErikBjare

Then you need to figure out why it can't find aw_server in the Python environment (what the check is for), after it has just been installed.

basically the following command does not have any output which indicates it is not installed.

pip freeze | grep server

I'll try to figure out what is the main reason then update this thread.

MohammadAliAfsahi avatar May 10 '24 16:05 MohammadAliAfsahi

@ErikBjare So the main reason that aw-server does not get installed is the following error

Screenshot from 2024-05-10 19-52-42

which is in aw-webui submodule: aw-server/aw-webui/vue.config.js:42:2

I could fix the issue by changing line 49 from the following: domain: import.meta.resolve('domain-browser'),

to

domain: path.resolve(__dirname, 'domain-browser'),

MohammadAliAfsahi avatar May 10 '24 16:05 MohammadAliAfsahi

@MohammadAliAfsahi Which Nodejs version are you running? I don't think that occurs for Node 18+ (at least not for Node 20 in CI).

ErikBjare avatar May 10 '24 17:05 ErikBjare

@MohammadAliAfsahi Which Nodejs version are you running? I don't think that occurs for Node 18+ (at least not for Node 20 in CI).

Yep. The main reason is Node version which is 16 in my case.

MohammadAliAfsahi avatar May 10 '24 17:05 MohammadAliAfsahi

Should update the docs to mention needing Node v20+, since that's what we use in CI.

On Fri, May 10, 2024, 19:20 MohammadAliAfsahi @.***> wrote:

@MohammadAliAfsahi https://github.com/MohammadAliAfsahi Which Nodejs version are you running? I don't think that occurs for Node 18+ (at least not for Node 20 in CI).

Yep. The main reason is Node version which is 16 in my case.

— Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/activitywatch/issues/1041#issuecomment-2104987701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKXDOXMWOYVZBLSZMAQMDDZBT6WDAVCNFSM6AAAAABFYUSFC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUHE4DONZQGE . You are receiving this because you were mentioned.Message ID: @.***>

ErikBjare avatar May 10 '24 17:05 ErikBjare

I fixed the issue where the aw-server build failed silently, causing the later error: https://github.com/ActivityWatch/activitywatch/commit/0520dd0727f261214742c98398f5e471bf7c6b70

Will also update the docs.

ErikBjare avatar May 11 '24 15:05 ErikBjare

This happens to me when trying to build for apple silicon Mac. I can't see any errors anywhere in the build logs, but pip freeze | grep server gives me nothing.

I have Node 20.11.1, latest rust nightly, Python 3.11.5, and the latest fix mentioned above is included in my AW sources.

Any ideas where to start looking for the possible cause?

kurrestahlberg avatar Aug 14 '24 07:08 kurrestahlberg

A snippet of some of my testing. I am not really familiar with Poetry, but I would assume this should now show aw_server on the list.

(venv) (base) kurre@Kurres-MacBook-Pro-2 aw-server % poetry build
Building aw-server (0.13.1)
  - Building sdist
  - Built aw_server-0.13.1.tar.gz
  - Building wheel
  - Built aw_server-0.13.1-py3-none-any.whl
(venv) (base) kurre@Kurres-MacBook-Pro-2 aw-server % poetry install
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: aw-server (0.13.1)
(venv) (base) kurre@Kurres-MacBook-Pro-2 aw-server % poetry show
aniso8601           9.0.1        A library for parsing ISO 8601 strings.
attrs               23.1.0       Classes Without Boilerplate
aw-client           0.5.12       Client library for ActivityWatch
aw-core             0.5.16       Core library for ActivityWatch
black               23.10.1      The uncompromising code formatter.
---- snip ----

kurrestahlberg avatar Aug 14 '24 07:08 kurrestahlberg