Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make build error in MacOs #433

Closed
snwnst opened this issue May 20, 2020 · 45 comments
Closed

Make build error in MacOs #433

snwnst opened this issue May 20, 2020 · 45 comments

Comments

@snwnst
Copy link

snwnst commented May 20, 2020

I am following the instructions of installing from source in MacOs and when i run make build got this 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
@johan-bjareholt
Copy link
Member

python -c "import aw_server; print(aw_server.__version__)"

I assume this is where it fails?

Seems like for some reason python fails to find aw_server as a python dependency, maybe something is not working properly with the virtualenv?

The exact same thing (make build) in our automated tests passed last time there was a change (5 days ago).

@snwnst
Copy link
Author

snwnst commented May 20, 2020

Yes, in that line got the error. I did a test without virtualenv and showed the same message.

@xylix
Copy link
Contributor

xylix commented May 25, 2020

Good catch. Can you try running the line "pip install poetry" in the venv and see if this fixes the problem? I tried to reproduce, got the different error ```
fi
Submodules seem to already be initialized, continuing...
make --directory=aw-core build
poetry install
make[1]: poetry: No such file or directory
make[1]: *** [build] Error 1
make: *** [build] Error 2

The installing-from-source documentation might not have been updated after the move to poetry. 

@snwnst
Copy link
Author

snwnst commented May 25, 2020

I also got that error the first time I ran the build. After running pip install poetry and running make build I received the error. Is there a missing step in the documentation that I'm not doing?

@stared
Copy link

stared commented May 26, 2020

On macOS, the install instruction is lacking:

  • poetry (need to be installed manually)
  • cargo (I didn't try to install it / don't know this tool)

How about a Makefile that involves:

  • creating a Python environment
  • installing poetry
  • installing cargo if needed (or using another tool)

?

@snwnst
Copy link
Author

snwnst commented May 26, 2020

Cargo is Rust’s build system and package manager. Rust nightly is necessary for this step:

make --directory=aw-server-rust build SKIP_WEBUI=$(SKIP_WEBUI)

I'm updating the documentation of installing from source. I'm basing to the travis.yml I found there about Rust and Poetry but I'm still stuck on the error

@ErikBjare
Copy link
Member

ErikBjare commented May 27, 2020

Not sure what's going wrong here, but a few things:

  • Make sure you have the virtualenv activated (if you don't, poetry will create it's own for each module, which will definitely not work).
  • Check which python is being used with which python, make sure that which python and which python3 has the same output (both in the virtualenv).
  • Run a Python interpreter within the virtualenv and check which packages are installed with import pkg_resources; installed_packages = [(d.project_name, d.version) for d in pkg_resources.working_set], make sure it looks as expected.

@iconma
Copy link

iconma commented Jun 12, 2020

if [ -e "aw-core/.git" ]; then
echo "Submodules seem to already be initialized, continuing...";
else
git submodule update --init --recursive;
fi
Submodules seem to already be initialized, continuing...
make --directory=aw-core build
poetry install
make[1]: poetry: No such file or directory
make[1]: *** [build] Error 1
make: *** [build] Error 2

Hi I am even facing the same issue, any one please help me in taking it forward.

@snwnst
Copy link
Author

snwnst commented Jun 13, 2020

Try running first pip install poetry and try again

@iconma
Copy link

iconma commented Jun 13, 2020

DONE  Build complete. The dist directory is ready to be deployed.
INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

cp -r aw-webui/dist/* aw_server/static/
# Needed for https://github.com/ActivityWatch/activitywatch/pull/274, works around https://github.com/pypa/pip/issues/6279
# https://github.com/ActivityWatch/activitywatch/pull/367 Other solutions have been tried but did not actually work.
# If you aren't sure windows long paths are working, don't remove this
rm -rf aw-webui/node_modules/.cache
poetry install

[EnvCommandError]
Command ['/Users/shyam/Library/Caches/pypoetry/virtualenvs/aw-server-iBkODlXh-py3.7/bin/python', '-'] errored with the following return code -6, and output:
dyld: Library not loaded: @executable_path/../Python3
  Referenced from: /Users/shyam/Library/Caches/pypoetry/virtualenvs/aw-server-iBkODlXh-py3.7/bin/python
  Reason: image not found
input was : import sys

if hasattr(sys, "real_prefix"):
    print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
    print(sys.base_prefix)
else:
    print(sys.prefix)

make: *** [build] Error 1

could install poetry but still the following error persists @snwnst
Screenshot 2020-06-13 at 10 11 57 AM

@ErikBjare
Copy link
Member

@iconma You need to run the make command in a virtualenv.

@iconma
Copy link

iconma commented Jun 13, 2020

Thanks for the info, But i m stuck here.
Say no cargo, checked poetry.lock there is no sign of cargo package in it.

make --directory=aw-server-rust build SKIP_WEBUI=
cargo build --release --bin aw-server
make[1]: cargo: No such file or directory
make[1]: *** [aw-server] Error 1
make: *** [build] Error 2
@snwnst how do we proceed further ?

commented and tried it out
#make --directory=aw-server-rust build SKIP_WEBUI=
It got generated.
python -c "import aw_server; print(aw_server.version)"
WARNING:root:Could not import pymongo, not available as a datastore backend
v0.8.dev+c6433ea

But when I type aw-qt it results me below error , help is appreciated
(venv) shyam@Admins-MacBook-Pro activitywatch % aw-qt

Traceback (most recent call last):
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (sip 5.3.0 (/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages), Requirement.parse('sip<4.20,>=4.19.4'), {'PyQt5'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/bin/aw-qt", line 6, in
from pkg_resources import load_entry_point
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3191, in
@_call_aside
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3175, in _call_aside
f(*args, **kwargs)
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3204, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 585, in _build_master
return cls._build_from_requirements(requires)
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'sip<4.20,>=4.19.4' distribution was not found and is required by PyQt5

@johan-bjareholt
Copy link
Member

To fix the building of aw-server-rust you need to install rust nightly and cargo, most easily done with rustup.

What's wrong with aw-qt is clear in the error message with the following

'sip<4.20,>=4.19.4' distribution was not found and is required by PyQt5

You are missing the sip dependency or have the wrong version of it required by pyqt5, or maybe your virtualenv is not set.

@iconma
Copy link

iconma commented Jun 15, 2020

Hi i have fixed venv properly,
now i am stuck with new error.

error: failed to run custom build command for `pear_codegen v0.1.2`

Caused by:
  process didn't exit successfully: `/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/target/release/build/pear_codegen-023f96d893d3f73f/build-script-build` (exit code: 101)
--- stderr
Error: Pear requires a nightly or dev version of Rust.
Installed version is: 1.44.0 (2020-06-01). Minimum required: 1.31.0-nightly (2018-10-05).
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', /Users/shyam/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/pear_codegen-0.1.2/build.rs:31:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rocket_codegen v0.4.3`

Caused by:
  process didn't exit successfully: `/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/target/release/build/rocket_codegen-fcea615b1b24c569/build-script-build` (exit code: 101)
--- stderr
Error: Rocket (codegen) requires a 'dev' or 'nightly' version of rustc.
Installed version: 1.44.0 (2020-06-01)
Minimum required:  1.33.0-nightly (2019-01-13)
See the getting started guide (https://rocket.rs/v0.5/guide/getting-started/) for more information.
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', /Users/shyam/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/rocket_codegen-0.4.3/build.rs:29:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rocket v0.4.3`

Caused by:
  process didn't exit successfully: `/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/target/release/build/rocket-917100f3155abaa9/build-script-build` (exit code: 101)
--- stderr
Error: Rocket (core) requires a 'dev' or 'nightly' version of rustc.
Installed version: 1.44.0 (2020-06-01)
Minimum required:  1.35.0-nightly (2019-04-05)
See the getting started guide (https://rocket.rs/v0.5/guide/getting-started/) for more information.
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', /Users/shyam/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/rocket-0.4.3/build.rs:29:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed
make[1]: *** [aw-server] Error 101
make: *** [build] Error 2

Screenshot 2020-06-15 at 10 33 46 AM

@ErikBjare
Copy link
Member

As the error says, you need a nightly version of Rust.

@iconma
Copy link

iconma commented Jun 15, 2020

Hi Erik,

but I have taken the latest version of it
Installed version: 1.44.0 (2020-06-01)
Minimum required: 1.35.0-nightly (2019-04-05)
The installed version is greater than the prescribed.
So still the issue persists.

@johan-bjareholt
Copy link
Member

Installed version: 1.44.0 (2020-06-01)
Minimum required: 1.35.0-nightly (2019-04-05)
The installed version is greater than the prescribed.

While the version is newer, since it does not end with "-nightly" you are not using the nightly version which means that some features are not enabled which are required.

@iconma
Copy link

iconma commented Jun 15, 2020

Thanks @johan-bjareholt i am using nightly and lets see how does it go

@iconma
Copy link

iconma commented Jun 15, 2020

Got following error.

[email protected] build /Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui
vue-cli-service build

⠙ Building for production...Starting type checking service...
Using 1 worker with 2048MB memory limit
⠦ Building for production...Browserslist: caniuse-lite is outdated. Please run next command npm update
⠙ Building for production...

ERROR Failed to compile with 1 errors 3:05:58 PM

error in ./src/App.vue?vue&type=template&id=5b53a00e&lang=pug&

Module build failed (from ./node_modules/pug-plain-loader/index.js):
TypeError: Cannot read property 'mb' of undefined
at eval (eval at wrap (/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/node_modules/pug-runtime/wrap.js:6:10), :4:5)
at template (eval at wrap (/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/node_modules/pug-runtime/wrap.js:6:10), :8:355)
at Object.module.exports (/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/node_modules/pug-plain-loader/index.js:13:10)

@ ./src/App.vue?vue&type=template&id=5b53a00e&lang=pug& 1:0-447 1:0-447
@ ./src/App.vue
@ ./src/main.js
@ multi ./src/main.js

Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-09bc37bc.3dfbcde6.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-0de517b8.aa8a4068.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-0e0e08d4.ac2b678d.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-1704d656.d747acf5.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-22291cfb.248cc02e.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2aac73c2.ef47c53e.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2ba3acfc.43cab2c4.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c0d7f.d7775635.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c76ef.4467ca36.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c7b05.f0058710.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c7f23.de0265ad.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c8a76.e4c138cb.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0c912a.42cb65b9.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0d6e9b.e3fd9ec1.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d0e4e00.e5a3ad50.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d217e1c.9fe87f3b.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d21a3d2.9287127e.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-2d21abe5.291cf8ce.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-34d4cb4e.61511ec1.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-3cb932d2.75a314de.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-481c03fc.bfd08a3b.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-4b8d39cb.917df9b3.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-53b16d6c.96edc420.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-548c38ca.9d910357.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-604b6336.17c25879.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-64b133d7.ccb61cfd.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-7cf84ed0.9e4cca50.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-8136d428.5f325ec7.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-85351898.80b793c6.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-88e324ee.ee676729.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-a1ed062e.8c6a91e1.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/chunk-vendors.b086e846.js": no such file
Error parsing bundle asset "/Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/js/index.039d6015.js": no such file

No bundles were parsed. Analyzer will show only original module sizes from stats file.

Webpack Bundle Analyzer saved report to /Users/shyam/Documents/activitywatch/activitywatch/aw-server-rust/aw-webui/dist/report.html
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shyam/.npm/_logs/2020-06-15T09_35_58_233Z-debug.log
make[1]: *** [build] Error 1
make: *** [aw-webui] Error 2

@iconma
Copy link

iconma commented Jun 16, 2020

Hi All ,

The build is complete successfully could generate the package, but while executing its returning below error.

Contents of ./dist
total 111592
drwxr-xr-x 67 shyam staff 2144 Jun 16 10:44 activitywatch
-rw-r--r-- 1 shyam staff 56310498 Jun 16 10:44 activitywatch-370b073-macos-x86_64.zip

(venv) shyam@admins-mbp activitywatch % aw-qt
Traceback (most recent call last):
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/bin/aw-qt", line 6, in
from pkg_resources import load_entry_point
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3250, in
@_call_aside
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3234, in _call_aside
f(*args, **kwargs)
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3263, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/shyam/Documents/activitywatch/activitywatch/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'sip<4.20,>=4.19.4' distribution was not found and is required by PyQt5

But during the course of the build, there are no such errors identified.
I can sense it its environmental issue. have installed rust with the nightly build.
(venv) shyam@admins-mbp activitywatch % rustc --version
rustc 1.46.0-nightly (feb3536eb 2020-06-09)
then after executing this returning following error.
One more thing make install is not working on macI BELIEVE it's for windows probably

Help is greatly appreciated.

@johan-bjareholt
Copy link
Member

It's the same error message as above and if I understood things correctly then you had some virtualenv issue?

What the error message says is pretty much that aw-qt fails to find correct dependencies on the following line:

pkg_resources.DistributionNotFound: The 'sip<4.20,>=4.19.4' distribution was not found and is required by PyQt5

@iconma
Copy link

iconma commented Jun 16, 2020

when trying to install sip 4.19.4 its saying not found.
Screenshot 2020-06-16 at 11 22 13 AM

@johan-bjareholt
Copy link
Member

Since the error earlier says that you need 'sip<4.20,>=4.19.4' you could just as well install 4.19.8 which is available according to the most recent error.

But it would be even better if you could figure out why PyQt did not install it in the first place, seems strange that it did not.

@iconma
Copy link

iconma commented Jun 16, 2020

installed the 4.19.8 version, but still the result says the same. wonder how to proceed further during build no such errors identified but while executing repeatedly encountering the same error.
Removed venv and have created after installing the 4.19.9 but still, the result is the same.
is there a way to verify the sip version is being currently pointed.

@iconma
Copy link

iconma commented Jun 16, 2020

Screenshot 2020-06-16 at 11 47 44 AM

@ErikBjare
Copy link
Member

This might actually be a larger issue as I've seen the same error appear in the automatic Travis builds (that run as cronjobs): https://travis-ci.org/github/ActivityWatch/activitywatch/builds/703142861

I managed to reproduce in my local (Linux) environment by running make build in aw-qt with a fresh environment. I added sip as an explicit dependency to pyproject.toml in aw-qt and that seems to fix it.

Still unsure how this appeared all of a sudden, but there's a PR with a fix here: ActivityWatch/aw-qt#60

ErikBjare added a commit to ActivityWatch/aw-qt that referenced this issue Jun 30, 2020
@nicolae-stroncea
Copy link
Member

@ErikBjare the commit actually broke the build for me on Linux. The logs said it couldn't find the sip version 4.19.8 and that only (5.0.0 + were available), I think due to the other dependencies.

I fixed it by deleting the sip line and instead adding:

Python="^3.6"
PyQt5="^5.10.1"

@ErikBjare
Copy link
Member

The problem with that solution, iirc, is PyQt5="^5.10.1" would make it pick a recent version of PyQt5 (check the poetry.lock) which doesn't play nice with PyInstaller on some platform(s) (there should be an issue about it somewhere).

Your installation probably fails because you use Python 3.8 or newer (for which sip<5.0 isn't available).

It's unfortunate that we've been caught in this PyQt5/PyInstaller mess, but I haven't gotten around to finding a fix for it yet.

@utkarshdalal
Copy link

utkarshdalal commented Aug 25, 2020

@ErikBjare I had the same problem - sip wasn't installing with python 3.8. After I read your previous comment and tried with python 3.7, it worked.

Can we document that somewhere so that future users running make build know they have to use <= python 3.7? What would an appropriate place to document this be?

@ppessi
Copy link

ppessi commented Sep 26, 2020

Due to wasting a ton of time because of this, I made a PR for the docs...

@ErikBjare
Copy link
Member

ErikBjare commented Oct 4, 2020

I'm trying to find the reason for the locked PyQt5, but after searching the issues I'm not finding anything. Maybe we should attempt to get with the times and try and upgrade at some point soon?

What do you think @johan-bjareholt? Do you remember what locking the PyQt5 version was about?

@johan-bjareholt
Copy link
Member

@ErikBjare I think it was something with a sub-dependency of newer qt versions not working correctly with pyinstaller. I might be wrong though.

@ErikBjare
Copy link
Member

@johan-bjareholt Weird that I can't find any mention of it in issues. I guess we should look at moving to the recently released PyInstaller 4.0 soon (with Python 3.8 support coming in 4.1), might as well take a swing at updating PyQt5 at the same time.

@stale
Copy link

stale bot commented Apr 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 3, 2021
@stale stale bot closed this as completed Apr 17, 2021
@michaeljelly
Copy link
Contributor

michaeljelly commented Dec 21, 2021

I'm running into the original issue @snwnst referenced today.

When running make build, I get the 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

I don't think @snwnst ever got his solved? Last comment said he was still stuck.

#433 (comment)

Seems like this thread slowly slipped into tangents! Would be cool to figure out what is happening such that python can't find the aw_server module.

I'm in a venv, have tried:

  1. pip install poetry
  2. poetry install
  3. Tried making just the aw-core directory with make --directory=aw-core build
  4. Tried making just the aw-server directory with make --directory=aw-server build
  5. same with server-rust

I'm using an M1 Mac, had to use arch86 to install pyqt5, and am generally using arch86 to run most of my commands.

Versions:
Python 3.8.9
Poetry version 1.1.12
pip version pip-21.3.1
Node v14.15.5
rustc 1.59.0-nightly (e95e084a1 2021-12-19)
7-Zip [64] 17.04

If I do which python and which python 3 I get:
.../activitywatch/venv/bin/python
.../activitywatch/venv/bin/python3

From what @ErikBjare suggested in @ErikBjare suggested in #433 (comment), this seems like it might be part of problem? I don't know how to fix that just yet, any tips appreciated.

Pretty sure poetry is creating a new virtual environment for each module. Before each module is installed it says this

rm -rf aw-webui/node_modules/.cache
poetry install
Creating virtualenv aw-server-3XYyaeic-py3.8 in /Users/michaeljelly/Library/Caches/pypoetry/virtualenvs

And you can also see that this is happening in this screenshot of poetry's virtualenv folder.

image

Nightmare! But at least I've identified that's what's happening. I'm currently looking into how to fix that, any rapid-response suggestions to stop poetry from doing this, or to make sure which python and python3 return the same (if this is the root cause) would be great! Will post back here once I know more about what's going on.

@ErikBjare
Copy link
Member

ErikBjare commented Dec 21, 2021

@michaeljelly If you're having issues with poetry creating a seperate venv for each module (which it shouldn't if you've already activated a venv, but you never know 🤷), you can disable it using this configuration option: https://python-poetry.org/docs/configuration/#local-configuration

Also, a nitpick about your process: don't install poetry in the venv, install it in your system/user Python 3 and then use it with the venv activated.

So, to modify your steps:

  1. pip install --upgrade poetry (globally)
  2. activate activitywatch venv
  3. make build in the root, or poetry install in Python submodule of choice

You might need to wipe your venv (to get rid of the poetry installation within) for your system-poetry to work correctly while it's active.

@michaeljelly
Copy link
Contributor

michaeljelly commented Dec 21, 2021

Thanks so much for the rapid response! Here's my poetry env info

Virtualenv
Python:         3.8.9
Implementation: CPython
Path:           /Users/michaeljelly/Build/Ethi/activitywatch/.venv
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8

Also I found the poetry config and have changed that so it doesn't create a separate venv. Config is now:

cache-dir = "/Users/michaeljelly/Library/Caches/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = false
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/michaeljelly/Library/Caches/pypoetry/virtualenvs

My "process" was to try everything haha! Just did that, and finding that I still can't get access to the aw_server module.

image

I have also tested installing with the poetry config experimental.new-installer = false, as well as true. When it's false, it doesn't create a new environment for every submodule, when it's true it does (or at least tells me about it)! I have also tested creating a venv called .venv as somewhere in the poetry docs it said that's what it looks for, but still no dice.

Will continue digging on the internet for why python is not able to find aw_server. Strange. Could somehow be an M1 mac problem? What made you say earlier about the which python/python3 paths needing to be the same?

@ErikBjare
Copy link
Member

ErikBjare commented Dec 21, 2021

On macOS, python has historically always pointed to the system Python 2.7 (not been a macOS user recently, so unsure about the current situation), while python3 has generally been used for user-installed Python.

Contrast that to modern Linux distros, where python == python3.

So, sanity check: Is your output from which python and which python3 the same? (in the active venv, but might be interesting to see the case for outside the venv too)

You could also just try and comment out the particular Makefile line (or change it to python3) to see if things work ok anyway?

We used to be explicit about using python3 everywhere (since we had similar issues in CI), but apparently that's not always the case anymore.

@michaeljelly
Copy link
Contributor

Possible weirdness found on running poetry debug


Poetry
Version: 1.1.12
Python:  3.9.7

Virtualenv
Python:         3.8.9
Implementation: CPython
Path:           /Users/michaeljelly/Build/Ethi/activitywatch/.venv
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8

I wouldn't expect my python version in Poetry and Virtualenv to be different. Would you?

Could be related to this python-poetry/poetry#3508

Going to try uninstalling and reinstalling poetry. Think I originally installed it via cURL :/

@michaeljelly
Copy link
Contributor

If I do which python and which python 3 I get:
.../activitywatch/venv/bin/python
.../activitywatch/venv/bin/python3

So they aren't the same, but python -V and python3 -V are the same. Will try changing the makefile to say python3!

@ErikBjare
Copy link
Member

If I do which python and which python 3 I get:
.../activitywatch/venv/bin/python
.../activitywatch/venv/bin/python3

They are the same. One of them is simply a symlink to the other.

@ErikBjare
Copy link
Member

Could be related to this python-poetry/poetry#3508

That looks possible...

@michaeljelly
Copy link
Contributor

michaeljelly commented Dec 21, 2021

Uninstalled poetry via curl, reinstalled it via pip3 install poetry, which meant I had the same python version between poetry and the virtualenv (when I ran poetry debug).

AND

I added a 3 to the Makefile python command (i.e. python3 -c "import aw_server; print(aw_server.__version__)")

and it seems to have worked!!

So future humans:

  1. try adding a 3 to the python command first
  2. make sure you install poetry using pip3, and check that when you run poetry debug it seems to be using the same python version
  3. disable poetry's creating of new environments locally in the project with poetry config virtualenvs.create false --local
  4. if you have an M1 mac, make sure you run the make command with arch -x86_64

Hopefully if you do these things you don't run into any of these problems! Thanks for your help @ErikBjare !

Maybe we should add the 3 to the Makefile? What do you think Erik?

@ErikBjare
Copy link
Member

@michaeljelly Nice! Yes, please make a PR to the repo :)

michaeljelly added a commit to michaeljelly/activitywatch that referenced this issue Dec 23, 2021
May have been what fixed build issue on M1 mac/with poetry
ActivityWatch#433 (comment)
@michaeljelly
Copy link
Contributor

There we go haha, tiny one!
#696

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants