You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: vocalpy won't work in jupyter notebook run in vscode after ipykernel install #193
Then I opened a new jupyter notebook in VScode and couldn't start the kernel in vocalpy because I didn't have ipykernel installed, so I installed ipykernel using:
conda install -n vocalpy ipykernel --update-deps --force-reinstall
Now I get this error when importing vocalpy into my jupyter notebook:
Is there a different ipykernel installation I should try that might not give me this error?
Hi @eintzandt sorry you're running into this issue, I'm happy to help.
Thank you for providing a detailed report of the problem.
My best guess is that you are right that some interaction of ipykernel and anaconda is the source of the problem, but I'm not sure why. (Edit: I don't usually run Jupyter notebooks in vs code so bear with me)
Can you please do the following for me?
run the following in the terminal, inside your activated vocalpy env: conda env export > environment.yml
then run conda list --explicit > spec-file.txt
reply to this with both of those files in a zip attachment (since GitHub won't let you reply with txt + yml files as attachments)
If you use Powershell, I am not sure those commands will work, so you may need to use Anaconda Prompt, that runs Windows terminal. They will help us see what's in the environment (I'm trying to figure out if maybe --update-deps installed a different version of pysoundfile or something.)
You could also try a couple of other things to confirm the problem is from conda + ipykernel interactions:
Make a Python virtualenv (without conda) and install both vocalpy and jupyterlab into that environment, and see if you can get that to run
make a conda env in the terminal with vocalpy + jupyterlab and then launch from the terminal, and see if it works then
If both of those "control experiments" work, then we know it's definitely something weird that happened from the ipykernel installation
If you're not sure how to do either of those last two things, let me know, and I can give you more step-by-step instructions
Thank you @eintzandt for the quick reply.
From those, it looks to me like both pysoundfile and the libsndfile that it uses are in fact the conda-forge versions -- so it's not because something else got installed.
One more question:
did you try restarting VS code?
I can test locally on a Windows machine to see if I can reproduce the bug.
It's not obvious to me what the fix would be so you can run in VS code.
You could maybe try conda uninstall pysoundfile followed by pip install soundfile so you are using the pure Python version that has its "own" versions of libsndfile built in?
Although IIUC in general we want to avoid using pip after conda when we care about reproducibility (just a heads up, apologies if you know this already).
Might also be worth trying to conda install ipykernel without the --update-deps --force-reinstall to see if that is the source of the problem.
If that fails, you might need to run Jupyter outside VS Code to use vocalpy. I want vocalpy to work for you in whatever way is convenient, though, happy to keep working with you to see if we can figure this out
Okay I got it to work by doing the following:
conda uninstall pysoundfile
pip install soundfile
(this caused vocalpy to uninstall, so then I did)
conda install vocalpy -c conda-forge
I think the conda version of pysoundfile must have caused some issues with Jupyter notebook in VS code. I've attached the zipped files again so you can see what versions of the packages ended up working. Thank you for your help! spec-file.zip
changed the title [-]BUG: OSError: cannot load library 'libsndfile.dll': error 0x7e after installing ipykernel[/-][+]BUG: vocalpy won't work in jupyter notebook run in vscode after ipykernel install[/+]on Oct 21, 2024
Activity
NickleDave commentedon Oct 21, 2024
Hi @eintzandt sorry you're running into this issue, I'm happy to help.
Thank you for providing a detailed report of the problem.
My best guess is that you are right that some interaction of ipykernel and anaconda is the source of the problem, but I'm not sure why. (Edit: I don't usually run Jupyter notebooks in vs code so bear with me)
Can you please do the following for me?
conda env export > environment.ymlconda list --explicit > spec-file.txtIf you use Powershell, I am not sure those commands will work, so you may need to use Anaconda Prompt, that runs Windows terminal. They will help us see what's in the environment (I'm trying to figure out if maybe
--update-depsinstalled a different version ofpysoundfileor something.)You could also try a couple of other things to confirm the problem is from conda + ipykernel interactions:
If both of those "control experiments" work, then we know it's definitely something weird that happened from the ipykernel installation
If you're not sure how to do either of those last two things, let me know, and I can give you more step-by-step instructions
eintzandt commentedon Oct 21, 2024
vocalpy_zip.zip
Here are the zipped files, I will test out your 2 suggestions now. Thank you!
NickleDave commentedon Oct 21, 2024
Thank you @eintzandt for the quick reply.
From those, it looks to me like both pysoundfile and the libsndfile that it uses are in fact the conda-forge versions -- so it's not because something else got installed.
One more question:
I can test locally on a Windows machine to see if I can reproduce the bug.
It's not obvious to me what the fix would be so you can run in VS code.
You could maybe try
conda uninstall pysoundfilefollowed bypip install soundfileso you are using the pure Python version that has its "own" versions of libsndfile built in?Although IIUC in general we want to avoid using pip after conda when we care about reproducibility (just a heads up, apologies if you know this already).
Might also be worth trying to
conda install ipykernelwithout the--update-deps --force-reinstallto see if that is the source of the problem.If that fails, you might need to run Jupyter outside VS Code to use vocalpy. I want vocalpy to work for you in whatever way is convenient, though, happy to keep working with you to see if we can figure this out
eintzandt commentedon Oct 21, 2024
Okay I got it to work by doing the following:
conda uninstall pysoundfile
pip install soundfile
(this caused vocalpy to uninstall, so then I did)
conda install vocalpy -c conda-forge
I think the conda version of pysoundfile must have caused some issues with Jupyter notebook in VS code. I've attached the zipped files again so you can see what versions of the packages ended up working. Thank you for your help!
spec-file.zip
[-]BUG: OSError: cannot load library 'libsndfile.dll': error 0x7e after installing ipykernel[/-][+]BUG: vocalpy won't work in jupyter notebook run in vscode after ipykernel install[/+]NickleDave commentedon Oct 21, 2024
Great, thank you @eintzandt for letting me know that workaround got you going for now!
I'll leave this and open and tweak the title a bit to remind me of the issue, will see if we can track down the source
NickleDave commentedon Oct 21, 2024
Note to self that this looked possibly related: bastibe/python-soundfile#373
Error is the same
But in traceback above it's in
.conda\envs\vocalpy\Library\binso it's not some system-wide Anaconda thingNickleDave commentedon Oct 25, 2025
@all-contributors please add @eintzandt for bug and data
allcontributors commentedon Oct 25, 2025
@NickleDave
I've put up a pull request to add @eintzandt! 🎉