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

Can't install kicad-diff on windows #1

Closed
jorlee99 opened this issue May 11, 2021 · 48 comments
Closed

Can't install kicad-diff on windows #1

jorlee99 opened this issue May 11, 2021 · 48 comments

Comments

@jorlee99
Copy link

I am trying to install the external dependencies on a windows machine but when I go through the steps of installing kicad-diff I get the following.

After running the command opam install plotkicadsch

`[ERROR] The compilation of plotkicadsch failed at
"C:\OCaml64\home\Stanley\.opam\4.09.1+mingw64c\bin\dune.exe
build -p plotkicadsch -j 5".

=== ERROR while compiling plotkicadsch.0.8.0 ==
===============================#
context 2.0.8 | win32/x86_64 | ocaml-variants.4.09.1+min
gw64c | pinned(file://C:/Users/Stanley/Desktop/ELEC)
path ~/.opam/4.09.1+mingw64c/.opam-switch/build/plotk
icadsch.0.8.0
command C:\OCaml64\home\Stanley.opam\4.09.1+mingw64c\bi
n\dune.exe build -p plotkicadsch -j 5
exit-code 1
env-file ~/.opam/log/plotkicadsch-21024-42bb52.env
output-file ~/.opam/log/plotkicadsch-21024-42bb52.out
output
File "plotkicadsch/plotkicadsch/src/dune", line 7, characters 6-1
4:
7 | kicadsch
^^^^^^^^
Error: Library "kicadsch" not found.
Hint: try:
dune external-lib-deps --missing -p plotkicadsch -j 5 @install`

And running the command suggested by the hint I get
$ dune external-lib-deps --missing -p plotkicadsch -j 5 @install Error: I don't know about package plotkicadsch (passed through -p)

I am not very sure how to get this running on windows

@jorlee99
Copy link
Author

Note I ran it on Linux using the same system and it seems fine

@leoheck
Copy link
Owner

leoheck commented May 11, 2021

Hey, @jorlee99 I never ran it on Window. But it looks like some users want this too.
Unfortunately, I don't have a Windows machine to test this.

Plotkicadsch is an external tool. Did you check this page? https://github.com/jnavila/plotkicadsch#windows
It looks like it has a version for windows.

My suggestion is to use the Windows Linux Subsystem (WLS) to try it first.

@leoheck
Copy link
Owner

leoheck commented May 11, 2021

What are the commands you are using to install opam/plotgitsch?

@jorlee99
Copy link
Author

jorlee99 commented May 11, 2021

The command I ran was opam install plotkicadsch. One thing to add is that it seems like it fails on the build of the actual installation.

@jorlee99
Copy link
Author

Hey, @jorlee99 I never ran it on Window. But it looks like some users want this too.
Unfortunately, I don't have a Windows machine to test this.

Plotkicadsch is an external tool. Did you check this page? https://github.com/jnavila/plotkicadsch#windows
It looks like it has a version for windows.

My suggestion is to use the Windows Linux Subsystem (WLS) to try it first.

Yea so the windows version I am trying to install it through opam which is how I ended up here. As for copying the binaries, I can't see to find the directory for them to just "copy them over".

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Check this answer from the Author of the plotkicadsch.
jnavila/plotkicadsch#49 (comment)

@jorlee99
Copy link
Author

jorlee99 commented May 12, 2021

Check this answer from the Author of the plotkicadsch.
jnavila/plotkicadsch#49 (comment)

I think this worked thanks for the help there! I posted my other error within that thread so hopefully that will get figured out. It seems I'm also getting errors on the KiCad-Diff plugin as well. It seems simpler but I am not sure?

So I'm using my bash console to change the path using the following command
source env.sh
and that seems to run just fine. But as soon as I run my ./kicad --help command I get the following
/usr/bin/env: ‘python3’: No such file or directory so it seems like it is trying to run the python file itself. So is the PATH variable not being set? Just as a note I am using git bash to do all my bash commands.
Am I possibly missing something basic here?

Thanks for your help!

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

launch kicad in a nother terminal.

@jorlee99
Copy link
Author

jorlee99 commented May 12, 2021

Ok I've made some progress in the mean time. I've gotten up to here on the windows machine. As for reference I am using the sample project from plotgitsch. I get the following on my webpage

Schematic Layout:
image

PCB Layout:
image

As you can see nothing is output for the schematic even though it should. As for the PCB layout it seems to take some place holder img file? I am not sure.

Inspecting the console output itself I get the following errors:
image

I have tested this on my linux OS of the project and it seems like it works fine? The schematic works just fine I have yet to test the PCB layout of the project. Any ideas? One thing to note is that when it outputs
Launching /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground/kidiff/schematic/web//main.html
No browser actually launches, this is probably due to the fact that I am using windows and opening it from the html file is not too much of a hassle.

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Delete the kidiff folder or use the -r flag when executing kdiff and test one more time.
But the projects you are showing does not have changes in the layout.

@jorlee99
Copy link
Author

Unfortunately there was no change after removing to folder. Yes you are correct there are no layout changes, but it seems as though it can't find the file itself and uses some placeholder image?

Delete the kidiff folder or use the -r flag when executing kdiff and test one more time.
But the projects you are showing does not have changes in the layout.

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

run it with the flag -V then it will show each command it is running
you can run each command manually to check if it is generating anything.

@jorlee99
Copy link
Author

Sure

$ kdiff schematic/kicad_playground.kicad_pcb -V

    script_dir: /cygdrive/c/Users/Stanley/Desktop/kdiff/kdiff

     repo_root: /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground
   project_dir: schematic

     kicad_pcb: schematic/kicad_playground.kicad_pcb
     sch_files: schematic/kicad_playground.sch schematic/LEDs.sch
    board_name: kicad_playground

    output_dir: /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground/kidiff/schematic
       web_dir: /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground/kidiff/schematic/web/

git-kdiff-log master -- schematic/kicad_playground.kicad_pcb schematic/kicad_playground.sch schematic/LEDs.sch

Commits list:
cdb8005 | 2018-10-17 22:24:22 +0200 | Jean-Noël Avila | Add a subsheet
064acea | 2018-10-17 22:18:43 +0200 | Jean-Noël Avila | Fix Led direction
fc6818f | 2018-10-17 22:17:10 +0200 | Jean-Noël Avila | Small update to schematic
8b0696a | 2018-10-17 22:10:27 +0200 | Jean-Noël Avila | Draft of the design
c0a3b8e | 2018-10-17 21:57:38 +0200 | Jean-Noël Avila | First commit

Generating artifacts for 5 commits.
Totaling 20 possible comparisons.

Schematic Pages
     1  kicad_playground
     2  LEDs

Layers

   1. c0a3b8e - 8b0696a

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b 8b0696a &> /dev/null
Status: 127

plotgitsch -l schematic/kicad_playground-cache.lib -c FF0000:008FFF:FFFFFF:222222 c0a3b8e 8b0696a &> /dev/null
Status: 0

   2.         - fc6818f

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b fc6818f &> /dev/null
Status: 127

plotgitsch -l schematic/kicad_playground-cache.lib -c FF0000:008FFF:FFFFFF:222222 c0a3b8e fc6818f &> /dev/null
Status: 0

   3.         - 064acea

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b 064acea &> /dev/null
Status: 127

plotgitsch -l schematic/kicad_playground-cache.lib -c FF0000:008FFF:FFFFFF:222222 c0a3b8e 064acea &> /dev/null
Status: 0

   4.         - cdb8005

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b cdb8005 &> /dev/null
Status: 127

plotgitsch -l schematic/kicad_playground-cache.lib -c FF0000:008FFF:FFFFFF:222222 c0a3b8e cdb8005 &> /dev/null
Status: 0


Launching /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground/kidiff/schematic/web//main.html

This is the output of the terminal

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Hm, did you install python dependencies?
I have this PR to fix this. Gasman2014/KiCad-Diff#47

Install these 2 python packages and try one more time.

  • pygubu==0.10.5
  • python_dateutil==2.8.1

@jorlee99
Copy link
Author

jorlee99 commented May 12, 2021

Hm, did you install python dependencies?
I have this PR to fix this. Gasman2014/KiCad-Diff#47

Install these 2 python packages and try one more time.

  • pygubu==0.10.5
  • python_dateutil==2.8.1

So I just installed those packages:
py -m pip install pygubu==0.10.5 Collecting pygubu==0.10.5 Downloading pygubu-0.10.5-py3-none-any.whl (62 kB) |████████████████████████████████| 62 kB 4.5 MB/s Installing collected packages: pygubu Successfully installed pygubu-0.10.5

py -m pip install python-dateutil Requirement already satisfied: python-dateutil in c:\users\stanley\appdata\local\programs\python\python38-32\lib\site-packages (2.8.1)

and unfortunately no luck same issue.

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Run this and share the output please

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b cdb8005

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Your board is inside a folder called schematic, is this right?
schematic/kicad_playground.kicad_pcb

@jorlee99
Copy link
Author

Your board is inside a folder called schematic, is this right?
schematic/kicad_playground.kicad_pcb
yup

Run this and share the output please

kidiff schematic/kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b cdb8005

I changed the directory to inside schematic and ran the following
$ kdiff kicad_playground.kicad_pcb --webserver-disable -a c0a3b8e -b cdb8005
and got the following output
The board cdb8005 does not exit

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Yes this happens because you have to pass 2 valid git revisions where you know the boards differs. You dont have changes in the layout. At least try to change something, then commit and then run the kdiff` again.

You can also explore kidiff with kdiff kicad_playground.kicad_pcb for instance.

@jorlee99
Copy link
Author

I removed a component and added a new commit so totaling to 6 commits now:

$ kdiff schematic/kicad_playground.kicad_pcb

Generating artifacts for 6 commits.
Totaling 30 possible comparisons.

   1. c0a3b8e - 8b0696a
   2.         - fc6818f
   3.         - 064acea
   4.         - cdb8005
   5.         - 0ae4cf0

Launching /cygdrive/c/Users/Stanley/Desktop/kdiff/kicad_playground/kidiff/schematic/web//main.html


And when doing your command of comparing two commits
$ kdiff kicad_playground.kicad_pcb --webserver-disable -a 8b0696a -b fc6818f
I still get the following
The board fc6818f does not exit

It seems like it's trying the use the commit as the file name currently? I'm not sure.

@leoheck
Copy link
Owner

leoheck commented May 12, 2021

Please, do this

You can also explore kidiff with kdiff kicad_playground.kicad_pcb for instance.

@jorlee99
Copy link
Author

Please, do this

You can also explore kidiff with kdiff kicad_playground.kicad_pcb for instance.

I'm sorry I am not understanding. Are you telling me to just play around with the command? It seems like it is running but the assets themselves aren't working as it doesn't know how to pull the svgs perhaps? Maybe I am understanding this wrong please correct me if I am wrong.

@jorlee99
Copy link
Author

A quick update, I have played around with my linux system and an idea had was to send the files of the kdiff folder to my windows system. This produces the following:
image

I think this means when running the kdiff command through bash on a windows system something messes up correct? However, looking at the PCB layout:
image

somehow the file goes missing (as the console can't find the svg) and it creates some place holder image.

@leoheck
Copy link
Owner

leoheck commented May 13, 2021

cool, let me see the main.html to check if the file references are correct.

@jorlee99
Copy link
Author

cool, let me see the main.html to check if the file references are correct.

My mistake it seems I was using a repo that didn't have PCB changes it's all working now:
image

So the file system of the output of kdiff on linux is fine. It just seems as though running the kdiff command through bash on windows it does not function?

@leoheck
Copy link
Owner

leoheck commented May 13, 2021

image

@jorlee99
Copy link
Author

My apologies. Here are their respective kdiff files (one from windows the other from linux).
kidifflinux.zip
kidiffwin.zip
There are a couple things that might be notable when running on the windows machine?
Firstly being when running source env.sh for kdiff
it outputs -bash$'\r': command not found
and when running source env.sh for the KiCad-Diff
it outputs readlink: unknown option -- b

Both seem ok? As I am running the kdiff command on the board I get the following as an example
image
As if the components svgs in my kicad are creating an error.

Apologies again.

@leoheck
Copy link
Owner

leoheck commented May 13, 2021

Yeah these scripts have to be tweaked a little bit.

@jorlee99
Copy link
Author

Yeah these scripts have to be tweaked a little bit.

Looking a bit more into it, I have tried the KiCad-Diff kidiff command in bash on windows and as stated above it returns
/usr/bin/env: ‘python3’: No such file or directory
Whereas on linux it runs just fine.
So do you think it may not be the script but rather KiCad-Diff itself because I noticed in the file structure comparing the windows linux, the index.html is missing. Any ideas?

@leoheck
Copy link
Owner

leoheck commented May 13, 2021

I am am running this just fine on Windows now.
Please, delete your repo Kicad-Diff and clone it again.
Also, both env.sh do not show any error.
Maybe it will be necessary to delete and clone kdiff too

@leoheck
Copy link
Owner

leoheck commented May 14, 2021

Kicad-Diff (kidiff) is working for me now, the env.sh was ok

This is the command line
image

This is the output of the Kicad-Diff (kidiff)
image

I am updating the README with some instructions. Check there if you need to do something else.

@leoheck
Copy link
Owner

leoheck commented May 14, 2021

plotgitch is not working for me yet.
to solve this, I just made an empty script called plotgitch and added it to the PATH.

Then kdiff is generating layout diffs, but it cannot load the page at the end. I have to update this to be a server instead like Kicad-Diff is.

To solve this, just load the Kicad-diff right after running kdiff. Like this

# Generate project diffs/images
project> kdiff board.kicad_pcb

# Worakaround to launch the server
project> kidiff board.kicad_pcb

Then a page will load, and then you have to replace the index.html to main.html
This is the URL that you have to use

http://127.0.0.1:8888/web/main.html

image

@leoheck
Copy link
Owner

leoheck commented May 14, 2021

Hey, @jorlee99 I pushed a change where it uses a webserver to launch the page at the end.
Could you try if it works for you?

@jorlee99
Copy link
Author

jorlee99 commented May 14, 2021

Hey, @jorlee99 I pushed a change where it uses a webserver to launch the page at the end.
Could you try if it works for you?

TLDR; Webpage launches but I am still encountering problems

Hi @leoheck, that's amazing that it's working on windows that means there is hope. Yea so your webserver seems to be working? For me it produces the following webpage.
image

So the webpage launches and that is great but i think the kdiff and kidiff commands are still broken for me somehow. Knowing that it works for you I must be missing something.

To start all over following your readme and unfortunately I will go painstakingly in depth so bear with me.
Running Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-2004 -OutFile ~/Downloads/ubuntu-2004.zip this zip contains nothing in it
ubuntu-2004.zip
So I downloaded the following version of ubuntu please let me know if it is the correct one if not could you direct me to another one?

Next, using the installed ubuntu 18.04 LTS version, I ran all your dependency commands in your read me and all of those installed just fine. Now we start encountering the real problems. So opam did not let me create a new compiler and the list of compilers only goes up to 4.07.0 with trunk versions of the 4.08.0. I used the compiler 4.07.0 when trying all the upcoming commands so that might be the source of the issue. When running your script install.sh one thing to note was that I did need to opam depext conf-m4.1 and opam depext plotkicadsch and opam install digestif or else it would throw errors. The Last error I got was this wall of text

image

So I can't get plotkicadsch installed. Moving on, I ran source env.sh for both kdiff and KiCad-Diff and ran their respective commands kdiff and kidiff these are the outputs I get.

kidiff command
image

kdiff command
image

so obviously with kdiff because plotkicadsch didnt get install it doesn't have plotgitsch.

Any ideas how to progress from here?

Thanks for your help so far though we seem close! @leoheck

@jorlee99
Copy link
Author

jorlee99 commented May 14, 2021

Hey, @jorlee99 I pushed a change where it uses a webserver to launch the page at the end.
Could you try if it works for you?

However, on Linux and it launches just fine. On a side note it seems the zoom while scrolling or panning is no longer working on the PCB layout nor does view types? I'm not sure if you're encountering the same problem
image

@leoheck
Copy link
Owner

leoheck commented May 14, 2021

Yeap, this webserver still has an issue loading the page. I will check how to improve this.
What works for me is to kind kdiff then it will load the webserver which will be loading forever... then click in the URL field. And hit enter one more time. It may work.

@jorlee99
Copy link
Author

Yeap, this webserver still has an issue loading the page. I will check how to improve this.
What works for me is to kind kdiff then it will load the webserver which will be loading forever... then click in the URL field. And hit enter one more time. It may work.

The webserver seems to running fine on linux so obviously it's a windows thing. But it seems to work with you by chance what ubuntu version are you running for your WSL.

@jorlee99
Copy link
Author

I have an update. I have it fully working on a windows machine now. The key thing I was missing was that you can NOT just do opam init on first installation. After some digging it turns out that WSL does not support sandboxing otherwise known as the bwrap command as referenced here a quick workaround is doing the following but do read the warnings concerning the matter as well. After doing that and following your other steps it works fine. Thanks so much! @leoheck

Yeap, this webserver still has an issue loading the page. I will check how to improve this.
What works for me is to kind kdiff then it will load the webserver which will be loading forever... then click in the URL field. And hit enter one more time. It may work.

as for the webpage issue you are correct sometimes it loads sometimes it doesn't but opening the file from the file explorer seems to work.

@leoheck
Copy link
Owner

leoheck commented May 15, 2021

Good, thanks for this finding. I am going to test to update the README.md.
Thank you for your help @jorlee99.

@leoheck
Copy link
Owner

leoheck commented May 15, 2021

Hey @jorlee99 could you test the last version of the code to see if it improve page loading for you?
It is not perfect but it should work normally now.

@leoheck leoheck reopened this May 15, 2021
@jorlee99
Copy link
Author

Hi @leoheck. Running the kdiff command I get the following webpage
image

I can access the directories and it leads me there eventually if I click the web folder.

@leoheck
Copy link
Owner

leoheck commented May 16, 2021

What is the command line you are using?
From where you are running this command?
Are you inside the project folder?

@leoheck
Copy link
Owner

leoheck commented May 16, 2021

I improve this code a little bit. Please, check if it is better now.
I still would like to know where you are running kdiff to check if this is related to your issue.

@jorlee99
Copy link
Author

jorlee99 commented May 17, 2021

What is the command line you are using?

I am currently using the ubuntu web store command line

From where you are running this command?

I like to put all my files in a folder at the same level as the .git folder
Ex: if i were to check a schematic it would be within folder/board.kicad_pcb
therefore the command would be kdiff folder/board.kicad_pcb

Are you inside the project folder?

Yes

And yes it is working again i get the following after running the command
image

@leoheck
Copy link
Owner

leoheck commented May 17, 2021

Cool, it looks like the nested project is not working anymore. I will try to address that today since I have repos with a nested projects

@jorlee99
Copy link
Author

I can start creating projects within projects if you would like me to test nested projects as well.

@leoheck
Copy link
Owner

leoheck commented May 17, 2021

Cool, thanks.

I think plotgitsh is not prepared for this yet. However, I pushed a workaround here. Do you want to test?

You can test like this:

  1. Create a repo, and put 2 kicad projects inside. Lets say
my-multiproject-repo/
   project1
      board.sch
   project2
      board.sch
  1. Make some changes in both board.sch
  2. Launch kdiff and check if the Root (schematic folder) shows the right pages. Before it was mixing histories from these schematics with the same name.

@leoheck
Copy link
Owner

leoheck commented May 17, 2021

Hey, I am going to close this.
Start a new issue if you see problems, cool?

@leoheck leoheck closed this as completed May 17, 2021
marcovannoord added a commit to marcovannoord/kiri that referenced this issue Dec 21, 2021
On my WSL2 installation, `/proc/version` prints out `Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) leoheck#1 SMP Wed Oct 28 23:40:43 UTC 2020`, so i made grep case-insensitive, to be able to correctly identify my machine being a WSL machine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants