# Manually installing Python package not found on Conda

**URL:** <https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572>\
**Category:** New to Julia\
**Tags:** python\
**Created:** [September 5, 2018, 9:34am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572 "2018-09-05T09:34:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Post date:** [September 5, 2018, 9:34am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/1 "2018-09-05T09:34:13Z")

</div>

Hello,  
Is there a specific protocol for manually installing Python packages into Julia for use with PyCall? Music21 is a package unavailable via Conda package manage that I downloaded via PIP into my native Anaconda Python folder. If I understand correctly, unless one alters the environment variable for Python’s initialization, the package must installed local to the Conda Julia folder if it is to be retrievable via PyCall.

The original Anaconda package was installed in ./anaconda3/lib/python3.6/site-packages (5.3.0). Mapping the hierarchy into Julia’s miniconda folder, I came up with /.julia/v0.6/Conda/deps/usr/lib/python3.7 as the place to store this. All I did was copy and paste the folder. I presume I did something wrong because I am receiving this error:

```julia
Main> @pyimport Music21 as mtw
ERROR: PyError (PyImport_ImportModule) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'Music21'")

Help is greatly appreciated. Thank you!

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [September 5, 2018, 10:30am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/2 "2018-09-05T10:30:33Z")

</div>

[This thread](https://discourse.julialang.org/t/pycall-pre-installing-a-python-package-required-by-a-julia-package/3316/3) might be able to help…?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 5, 2018, 11:45am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/3 "2018-09-05T11:45:27Z")

</div>

See [A Documented/Preferred way of installing PyPi dependencies · Issue #50 · JuliaPy/Conda.jl · GitHub](https://github.com/JuliaPy/Conda.jl/issues/50) and in particular [this example](https://github.com/oxinabox/SwiftObjectStores.jl/blob/fee6a7bdd6d4b9a1a6865b95f4629d919a28947b/deps/build.jl#L7-L10).

---

<div class="post-metadata">

**Author:** ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Post date:** [September 5, 2018, 9:12pm UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/4 "2018-09-05T21:12:12Z")

</div>

I was able to get Music21 installed thanks to your suggestions. As far as using PyCall to reference a specific function, I am having trouble.

According to [Music21’s website](http://web.mit.edu/music21/), in order to display a short melody in musical notation one would type this in Python:  
`converter.parse("tinynotation: 3/4 c4 d8 f g16 a g f#").show()`

I did this to initialize music21, which seemed to work:

```julia
@pyimport music21
music21: Certain music21 functions might need these optional packages: matplotlib, scipy;
                   if you run into errors, install them by following the instructions at
                   http://mit.edu/music21/doc/installing/installAdditional.html

```

Now, I am trying to recreate the above Python example in Julia by typing:

```julia
converter.parse("tinynotation: 3/4 c4 d8 f g16 a g f#").show()
ERROR: UndefVarError: converter not defined
Stacktrace:
 [1] eval(::Module, ::Any) at ./boot.jl:235

```

Can anyone help me discover what I am doing wrong?

Thanks,  
Nakul

---

<div class="post-metadata">

**Author:** ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Post date:** [September 6, 2018, 5:51am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/5 "2018-09-06T05:51:27Z")

</div>

For those who are curious, I was able to ascertain the secondary solution. It has to do with dot overloading.

[This stack overflow thread gets to the bottom of the problem.](https://stackoverflow.com/questions/52196356/julia-pycall-difficulties-in-running-modules-of-music21)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 6, 2018, 11:48am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/6 "2018-09-06T11:48:05Z")

</div>

Looks like the equivalent is:

```julia
music21 = pyimport("music21")
music21[:converter][:parse]("tinynotation: 3/4 c4 d8 f g16 a g f#")[:show]()

```

---

<div class="post-metadata">

**Author:** ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Post date:** [September 8, 2018, 5:45am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/7 "2018-09-08T05:45:15Z")

</div>

Thank you @stevengj ! By the way, I’m a fan of [this Pull Request](https://github.com/JuliaPy/PyCall.jl/pull/517) because it simplifies a lot of syntax in the manner that one would expect to see in Python. I understand that there are talks to merge this pull request soon.

In the interim, I was wondering if there was a way of instead using PyCall in such a way that I can run a large block of code using native Python syntax akin to the syntax described in the pull request. Specifically, I am seeing if I can avoid repeatedly using the [:show] syntax so that my code is backwards compatible with Python as well as future releases of PyCall if/once the pull request gets merged.

For example:

PyCall(#run python script)

converter.parse(“tinynotation: 3/4 c4 d8 f g16 a g f#”).show()  
#more blocks of python code

#end of script

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 8, 2018, 12:05pm UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/8 "2018-09-08T12:05:50Z")

</div>

> [@Nakul\_Tiruviluamala](#):
>
> if there was a way of instead using PyCall in such a way that I can run a large block of code using native Python syntax

```julia
py"""
...Python code...
"""

```

---

<div class="post-metadata">

**Author:** ![Nakul\_Tiruviluamala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nakul_tiruviluamala/32/11228_2.png) [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Post date:** [September 9, 2018, 5:44am UTC](https://discourse.julialang.org/t/manually-installing-python-package-not-found-on-conda/14572/9 "2018-09-09T05:44:29Z")

</div>

Thank you very much. That’s awesome. Happy birthday by the way! @stevengj
